Skip to content

Commit

Permalink
Merge branch 'release/0.12.0' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
paulodiniz committed Mar 9, 2021
2 parents 62ebba9 + fcb8717 commit ef071c3
Show file tree
Hide file tree
Showing 145 changed files with 2,066 additions and 895 deletions.
6 changes: 6 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
version: 2
updates:
- package-ecosystem: "npm"
directory: "/"
schedule:
interval: "daily"
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
docs/docs/cli/reference.md
build/
bazel-*
24 changes: 0 additions & 24 deletions .prettierrc.json

This file was deleted.

8 changes: 7 additions & 1 deletion BUILD
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
load("@com_github_airyhq_bazel_tools//lint:buildifier.bzl", "check_pkg")
load("@com_github_airyhq_bazel_tools//lint:prettier.bzl", "fix_prettier")
load("@rules_java//java:defs.bzl", "java_library", "java_plugin")
load("@io_bazel_rules_docker//container:container.bzl", "container_image")
load("@com_github_atlassian_bazel_tools//multirun:def.bzl", "multirun")
Expand All @@ -12,10 +13,15 @@ alias(
actual = "//:bazel.tsconfig.json",
)

fix_prettier(
name = "fix_prettier",
ignore = "//:.prettierignore",
)

multirun(
name = "fix",
commands = [
"@com_github_airyhq_bazel_tools//lint:fix_prettier",
":fix_prettier",
"@com_github_airyhq_bazel_tools//lint:fix_buildifier",
],
visibility = ["//visibility:public"],
Expand Down
25 changes: 12 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,26 +13,25 @@
[![License](https://img.shields.io/github/license/airyhq/airy)](https://github.com/airyhq/airy/blob/develop/LICENSE)
[![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square)](https://github.com/airyhq/airy/projects)


Airy Core is an open source, fully-featured, production ready messaging
platform. With Airy you can process conversational data from a variety of
sources:

- **Facebook**
- **WhatsApp**
- **Google's Business Messages**
- **SMS**
- **Website Chat Plugins**
- **Twilio**
- **Your own conversational channels**
- **Facebook**
- **WhatsApp**
- **Google's Business Messages**
- **SMS**
- **Website Chat Plugins**
- **Twilio**
- **Your own conversational channels**

You can then use Airy to:

- **Unify your messaging channels**
- **Stream your conversational data wherever you want**
- **Integrate with different NLP frameworks**
- **Mediate open requests with Agents via our messaging UI**
- **Analyze your conversations**
- **Unify your messaging channels**
- **Stream your conversational data wherever you want**
- **Integrate with different NLP frameworks**
- **Mediate open requests with Agents via our messaging UI**
- **Analyze your conversations**

Since Airy's infrastructure is built around Apache Kafka, it can process a large
amount of conversations and messages simultaneously and stream the relevant
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.11.0
0.12.0
8 changes: 6 additions & 2 deletions WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ load("@bazel_tools//tools/build_defs/repo:git.bzl", "git_repository")
# Airy Bazel tools
git_repository(
name = "com_github_airyhq_bazel_tools",
commit = "da1aa5af0f03767d08ed8af478248d3709342252",
commit = "9cf55cc0a42d68f0198883b04493ce7c7b3113ed",
remote = "https://github.com/airyhq/bazel-tools.git",
shallow_since = "1614184856 +0100",
shallow_since = "1614958086 +0100",
)

load("@com_github_airyhq_bazel_tools//:repositories.bzl", "airy_bazel_tools_dependencies", "airy_jvm_deps")
Expand Down Expand Up @@ -130,6 +130,10 @@ load("@io_bazel_rules_go//go:deps.bzl", "go_register_toolchains", "go_rules_depe

go_rules_dependencies()

load("@io_bazel_rules_go//extras:embed_data_deps.bzl", "go_embed_data_dependencies")

go_embed_data_dependencies()

go_register_toolchains(nogo = "@//:airy_nogo") # my_nogo is in the top-level BUILD file of this workspace

load("@bazel_gazelle//:deps.bzl", "gazelle_dependencies")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,19 +27,18 @@
@RestController
public class TemplatesController {
private final Stores stores;
private final ObjectMapper objectMapper;
private final ObjectMapper objectMapper = new ObjectMapper();

public TemplatesController(Stores stores, ObjectMapper objectMapper) {
public TemplatesController(Stores stores) {
this.stores = stores;
this.objectMapper = objectMapper;
}

@PostMapping("/templates.create")
ResponseEntity<?> createTemplate(@RequestBody @Valid CreateTemplateRequestPayload payload) throws JsonProcessingException {
final Template template = Template.newBuilder()
.setId(UUID.randomUUID().toString())
.setName(payload.getName())
.setContent(payload.getContent())
.setContent(objectMapper.writeValueAsString(payload.getContent()))
.setVariables(objectMapper.writeValueAsString(payload.getVariables()))
.build();

Expand Down Expand Up @@ -89,14 +88,23 @@ ResponseEntity<?> listTemplates(@RequestBody @Valid ListTemplatesRequestPayload

@PostMapping("/templates.update")
ResponseEntity<?> updateTemplate(@RequestBody @Valid UpdateTemplateRequestPayload payload) throws JsonProcessingException {
final Template template = stores.getTemplate(payload.getName());
final Template template = stores.getTemplate(payload.getId().toString());

if (template == null) {
return ResponseEntity.notFound().build();
}

template.setContent(payload.getName());
template.setContent(objectMapper.writeValueAsString(payload.getContent()));
if (payload.getName() != null) {
template.setName(payload.getName());
}

if (payload.getContent() != null) {
template.setContent(objectMapper.writeValueAsString(payload.getContent()));
}

if (payload.getVariables() != null) {
template.setVariables(objectMapper.writeValueAsString(payload.getVariables()));
}

try {
stores.storeTemplate(template);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public class CreateTemplateRequestPayload {
@NotNull
private String name;
@NotNull
private String content;
private JsonNode content;
@Valid
@NotNull
private JsonNode variables;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,7 @@
public class UpdateTemplateRequestPayload {
@NotNull
private UUID id;
@NotNull
private String name;
@Valid
@NotNull
private JsonNode content;
private JsonNode variables;
}
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,8 @@ void beforeEach() throws Exception {
@Test
void canManageTemplates() throws Exception {
final String name = "awesome-template";
final String content = "{\\\"blueprint\\\":\\\"text\\\",\\\"payload\\\":\\\"[[salutation]]!\\\"}";
final String payload = "{\"name\":\"" + name + "\",\"content\": \"" + content + "\", \"variables\": { \"en\": {\"salutation\": \"Hello\"}}}";
final String content = "{\"blueprint\":\"text\",\"payload\":\"[[salutation]]!\"}";
final String payload = "{\"name\":\"" + name + "\",\"content\":" + content + ",\"variables\": { \"en\": {\"salutation\": \"Hello\"}}}";

final String createTagResponse = webTestHelper.post("/templates.create", payload, "user-id")
.andExpect(status().isCreated())
Expand All @@ -98,7 +98,7 @@ void canManageTemplates() throws Exception {
webTestHelper.post("/templates.info", "{\"id\":\"" + templateId + "\"}", "user-id")
.andExpect(status().isOk())
.andExpect(jsonPath("$.id").value(is(templateId)))
.andExpect(jsonPath("$.content").value(is("{\"blueprint\":\"text\",\"payload\":\"[[salutation]]!\"}")))
.andExpect(jsonPath("$.content").value(is(content)))
.andExpect(jsonPath("$.variables.en.salutation").value(is("Hello")))
.andExpect(jsonPath("$.name").value(is(name)));

Expand All @@ -108,6 +108,17 @@ void canManageTemplates() throws Exception {
.andExpect(jsonPath("$.data[0].id").value(is(templateId)))
.andExpect(jsonPath("$.data[0].name").value(is(name)));

webTestHelper.post("/templates.update", "{\"id\":\"" + templateId + "\", \"name\": \"new-template-name\", \"content\": " + content + "}", "user-id")
.andExpect(status().isOk())
.andExpect(jsonPath("$.id").value(is(templateId)))
.andExpect(jsonPath("$.content").value(is(content)))
.andExpect(jsonPath("$.variables.en.salutation").value(is("Hello")))
.andExpect(jsonPath("$.name").value(is("new-template-name")));

webTestHelper.post("/templates.info", "{\"id\":\"" + templateId + "\"}", "user-id")
.andExpect(status().isOk())
.andExpect(jsonPath("$.name").value(is("new-template-name")));

webTestHelper.post("/templates.list", "{}", "user-id")
.andExpect(status().isOk())
.andExpect(jsonPath("$.data.length()", is(1)));
Expand Down
10 changes: 0 additions & 10 deletions docs/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,6 @@ load("@com_github_airyhq_bazel_tools//lint:prettier.bzl", "prettier")

prettier(
name = "prettier",
srcs = glob([
"**/*.md",
"**/*.js",
"**/*.jsx",
"**/*.ts",
"**/*.tsx",
"**/*.scss",
"**/*.css",
]),
config = "//:.prettierrc.json",
ignore = "//:.prettierignore",
)

Expand Down
2 changes: 1 addition & 1 deletion docs/cli-doc/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ go_library(
"ProjectDir": "{PROJECT_DIR}",
},
deps = [
"//infrastructure/cli/cmd",
"//infrastructure/cli/pkg/cmd",
"@com_github_spf13_cobra//:cobra",
],
)
Expand Down
2 changes: 1 addition & 1 deletion docs/cli-doc/generate_cli_docs.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package main

import (
"bufio"
"cli/cmd"
"cli/pkg/cmd"
"os"
"path/filepath"
"sort"
Expand Down
Loading

0 comments on commit ef071c3

Please sign in to comment.