diff --git a/.github/workflows/check_with_databases.yml b/.github/workflows/check_with_databases.yml index c6b97b53..74b49572 100644 --- a/.github/workflows/check_with_databases.yml +++ b/.github/workflows/check_with_databases.yml @@ -1,3 +1,4 @@ +--- on: push: branches: @@ -105,7 +106,12 @@ jobs: uses: r-lib/actions/setup-r-dependencies@v2 with: # Necessary to avoid object usage linter errors. - extra-packages: local::. + extra-packages: | + local::. + any::rcmdcheck + any::spelling + any::lintr + any::covr - name: Install Microsoft ODBC ################################### diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 1c044cba..b61aa766 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -1,3 +1,4 @@ +--- on: push: branches: @@ -57,7 +58,11 @@ jobs: uses: r-lib/actions/setup-r-dependencies@v2 with: # Necessary to avoid object usage linter errors. - extra-packages: local::. + extra-packages: | + local::. + any::rcmdcheck + any::spelling + any::lintr - name: R CMD check ########################### diff --git a/.github/workflows/pkgdown.yml b/.github/workflows/pkgdown.yml index a8edc0a3..78a41878 100644 --- a/.github/workflows/pkgdown.yml +++ b/.github/workflows/pkgdown.yml @@ -1,3 +1,4 @@ +--- # Workflow derived from https://github.com/r-lib/actions/tree/v2/examples # Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help on: diff --git a/.github/workflows/prepare_connect.yml b/.github/workflows/prepare_connect.yml index 8d676518..2fee67c7 100644 --- a/.github/workflows/prepare_connect.yml +++ b/.github/workflows/prepare_connect.yml @@ -1,5 +1,10 @@ +--- on: push: + branches: + - main + pull_request: + workflow_dispatch: name: Prepare Connect Deployment diff --git a/DESCRIPTION b/DESCRIPTION index e54996e9..86ec964a 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,64 +1,58 @@ -Package: shiny.telemetry Type: Package +Package: shiny.telemetry Title: 'Shiny' App Usage Telemetry -Version: 0.1.0.9003 -Authors@R: - c( - person("André", "Veríssimo", role = c("aut", "cre"), email = "opensource+andre@appsilon.com"), - person("Kamil", "Żyła", role = c("aut"), email = "kamil@appsilon.com"), - person("Krystian", "Igras", role = "aut", email = "krystian8207@gmail.com"), - person("Recle", "Vibal", role = "aut", email = "recle.vibal@appsilon.com"), - person("Appsilon Sp. z o.o.", role = "cph", email = "opensource@appsilon.com") +Version: 0.2.0 +Authors@R: c( + person("André", "Veríssimo", , "opensource+andre@appsilon.com", role = c("aut", "cre")), + person("Kamil", "Żyła", , "kamil@appsilon.com", role = "aut"), + person("Krystian", "Igras", , "krystian8207@gmail.com", role = "aut"), + person("Recle", "Vibal", , "recle.vibal@appsilon.com", role = "aut"), + person("Appsilon Sp. z o.o.", , , "opensource@appsilon.com", role = "cph") ) -Description: - Enables instrumentation of 'Shiny' apps for tracking user session events - such as input changes, browser type, and session duration. - These events can be sent to any of the available storage backends - and analyzed using the included 'Shiny' app to gain insights about app usage and adoption. -URL: https://appsilon.github.io/shiny.telemetry/, https://github.com/Appsilon/shiny.telemetry -BugReports: https://github.com/Appsilon/shiny.telemetry/issues +Description: Enables instrumentation of 'Shiny' apps for tracking user + session events such as input changes, browser type, and session + duration. These events can be sent to any of the available storage + backends and analyzed using the included 'Shiny' app to gain insights + about app usage and adoption. License: LGPL-3 -Encoding: UTF-8 -LazyData: true -Suggests: - box, - config, - covr, - DT, - here, - lintr, - mockery, - plotly, - plumber, - rcmdcheck, - RColorBrewer, - RMariaDB, - RPostgreSQL, - scales, - semantic.dashboard (>= 0.1.1), - shiny.semantic (>= 0.2.0), - shinyjs, - spelling, - stringr, - testthat (>= 3.1.7), - timevis, - withr +URL: https://appsilon.github.io/shiny.telemetry/, + https://github.com/Appsilon/shiny.telemetry +BugReports: https://github.com/Appsilon/shiny.telemetry/issues Imports: - checkmate, - digest, - dplyr (>= 1.1.0), - glue, - httr2, - jsonlite, - logger, - lubridate, - odbc, - purrr, - R6, - rlang, - RSQLite, - shiny, - tidyr -RoxygenNote: 7.2.3 + checkmate, + digest, + dplyr (>= 1.1.0), + glue, + httr2, + jsonlite, + logger, + lubridate, + odbc, + purrr, + R6, + rlang, + RSQLite, + shiny, + tidyr +Suggests: + box, + config, + covr, + DT, + plotly, + plumber, + RColorBrewer, + RMariaDB, + RPostgreSQL, + scales, + semantic.dashboard (>= 0.1.1), + shiny.semantic (>= 0.2.0), + shinyjs, + testthat (>= 3.1.7), + timevis, + withr Config/testthat/edition: 3 +Encoding: UTF-8 Language: en-US +LazyData: true +RoxygenNote: 7.2.3 diff --git a/NEWS.md b/NEWS.md index b503e5f2..a8f21760 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,10 +1,20 @@ -# shiny.telemetry (development version) +# shiny.telemetry 0.2.0 -- Fixed the way of getting the session token. -- Allowed optional username overwrite. -- Added MS SQL Server support (see `DataStorageMSSQLServer` class). -- Added CI tests all DBI-based DataStorage providers. -- Added optional parameter to `read_event_data` that filters by `app_name`. +### New Features + +- Allowed optional username overwrite (#123). +- Added MS SQL Server support (see `DataStorageMSSQLServer` class) (#128). +- Added CI tests to all `DBI`-based `DataStorage` providers (#129). +- Added optional parameter to `read_event_data` that filters by `app_name` (#129). + +### Bug fixes + +- Fixed the way of getting the session token (#120). +- Fixed loading of complex nested payloads (#133). + +### Miscellaneous + +- Added `pre-commit` hooks (#140). # shiny.telemetry 0.1.0 diff --git a/R/auxiliary.R b/R/auxiliary.R index 3b22f5f0..6841cfc4 100644 --- a/R/auxiliary.R +++ b/R/auxiliary.R @@ -60,7 +60,7 @@ build_query_sql <- function( } query <- c(query, do.call(glue::glue, where)) - do.call(glue::glue, query) %>% stringr::str_trim() + trimws(do.call(glue::glue, query)) } #' Process a row's detail (from DB) in JSON format to a data.frame diff --git a/README.md b/README.md index 7ba03a8b..932741a6 100644 --- a/README.md +++ b/README.md @@ -117,7 +117,8 @@ logger::log_threshold("DEBUG", namespace = "shiny.telemetry") _note_: This command can be run before the Shiny call or by adding it to the `.Rprofile`. ## Contributing -See [CONTRIBUTING](./CONTRIBUTING.md). + +See [CONTRIBUTING](https://appsilon.github.io/shiny.telemetry/CONTRIBUTING.html). ## Appsilon diff --git a/inst/WORDLIST b/inst/WORDLIST index 565dde7a..637fa020 100644 --- a/inst/WORDLIST +++ b/inst/WORDLIST @@ -5,7 +5,6 @@ DataStorage JSON Javascript Logfile -MacOS ODBC RStudio Rhinoverse @@ -17,12 +16,9 @@ appsilon cloneable customizable filesystem -homebrew hostname json -linter lubridate -pre runApp sqlfile sqlite diff --git a/inst/examples/app/REAME.md b/inst/examples/app/REAME.md new file mode 100644 index 00000000..6ae26249 --- /dev/null +++ b/inst/examples/app/REAME.md @@ -0,0 +1,24 @@ +## Example application for {shiny.telemetry} + +> Simple Shiny dashboard with inputs and tabular navigation to test run `shiny.telemetry` + +These 2 folders contain an example application that tracks all inputs using `shiny.telemtry` and the accompanying analytics dashboard. + +#### Run the example + +To run the application, install the necessary dependencies: + +```R +install.packages( + c( + "shiny.telemetry", "dplyr", "config" + ), + dependencies = c("Depends", "Imports", "Suggests") +) +``` + +And start the R/Shiny app by: `shiny::runApp("instrumentation")` + +Afterwards, the analytics application will have access to the data and can be started by: `shiny::runApp("instrumentation")` + +For more information, visit the [documentation](https://appsilon.github.io/shiny.telemetry/) of `shiny.telemetry` diff --git a/tests/testthat/helper-mock-request.R b/tests/testthat/helper-mock-request.R index 47b872c5..cd5127e2 100644 --- a/tests/testthat/helper-mock-request.R +++ b/tests/testthat/helper-mock-request.R @@ -6,7 +6,7 @@ mock_request <- function(..., .secret = "", .serialize_data = FALSE) { token <- "" id <- "" - if (!is.null(.secret) && stringr::str_trim(.secret) != "") { + if (!is.null(.secret) && !identical(trimws(.secret), "")) { args_token_input <- args if (.serialize_data && !is.null(req$args$data)) {