From 3290099b8f103f4be6793b8090632bbcbb7b2f2e Mon Sep 17 00:00:00 2001 From: Antoine Lachance-Perreault Date: Fri, 6 Feb 2026 11:39:19 -0500 Subject: [PATCH 1/2] remove map_dfr - closes posit-dev/connectapi#422 --- R/get.R | 21 +++++++++++++++------ R/groups.R | 23 +++++++++++++++-------- R/parse.R | 6 +++--- R/runtime-caches.R | 2 +- R/tags.R | 4 ++-- 5 files changed, 36 insertions(+), 20 deletions(-) diff --git a/R/get.R b/R/get.R index 01e41f060..d9f9e76c1 100644 --- a/R/get.R +++ b/R/get.R @@ -1056,7 +1056,11 @@ get_aws_credentials <- function(connect, user_session_token, audience = NULL) { #' } #' #' @export -get_aws_content_credentials <- function(connect, content_session_token = NULL, audience = NULL) { +get_aws_content_credentials <- function( + connect, + content_session_token = NULL, + audience = NULL +) { error_if_less_than(connect$version, "2025.03.0") if (!is.null(audience)) { @@ -1131,11 +1135,16 @@ get_runtimes <- function(client, runtimes = NULL) { } } - purrr::map_dfr(runtimes, function(runtime) { - res <- client$GET(paste0("v1/server_settings/", runtime)) - res_df <- purrr::map_dfr(res$installations, ~ tibble::as_tibble(.)) - tibble::add_column(res_df, runtime = runtime, .before = 1) - }) + purrr::list_rbind(purrr::map( + runtimes, + function(runtime) { + res <- client$GET(paste0("v1/server_settings/", runtime)) + res_df <- purrr::list_rbind( + purrr::map(res$installations, ~ tibble::as_tibble(.)) + ) + tibble::add_column(res_df, runtime = runtime, .before = 1) + } + )) } #' All package dependencies on the server diff --git a/R/groups.R b/R/groups.R index 716ffdc46..79d98edbc 100644 --- a/R/groups.R +++ b/R/groups.R @@ -149,9 +149,11 @@ get_group_members <- function(src, guid) { get_group_content <- function(src, guids) { validate_R6_class(src, "Connect") - purrr::map_dfr( - guids, - ~ get_one_groups_content(src = src, guid = .x) + purrr::list_rbind( + purrr::map( + guids, + ~ get_one_groups_content(src = src, guid = .x) + ) ) } @@ -172,11 +174,16 @@ get_one_groups_content <- function(src, guid) { } parsed <- parse_connectapi_typed(res, connectapi_ptypes$group_content) - permissions_df <- purrr::map_dfr( - parsed$permissions, - ~ purrr::keep( - .x, - ~ .x[["principal_guid"]] == guid + permissions_df <- purrr::list_rbind( + purrr::map( + parsed$permissions, + ~ tibble::as_tibble(unlist( + purrr::keep( + .x, + ~ .x[["principal_guid"]] == guid + ), + recursive = FALSE + )) ) ) diff --git a/R/parse.R b/R/parse.R index 22d582fef..d9e29e68e 100644 --- a/R/parse.R +++ b/R/parse.R @@ -82,10 +82,10 @@ parse_connectapi_typed <- function(data, ptype, strict = FALSE) { } parse_connectapi <- function(data) { - tibble::as_tibble(purrr::map_df( + purrr::list_rbind(purrr::map( data, function(x) { - purrr::map( + tibble::as_tibble(purrr::map( .x = x, .f = function(y) { if (is.list(y)) { @@ -100,7 +100,7 @@ parse_connectapi <- function(data) { } return(prep) } - ) + )) } )) } diff --git a/R/runtime-caches.R b/R/runtime-caches.R index c770b2def..11ed4fcc4 100644 --- a/R/runtime-caches.R +++ b/R/runtime-caches.R @@ -21,7 +21,7 @@ get_runtime_caches <- function(client) { validate_R6_class(client, "Connect") res <- client$GET(v1_url("system/caches/runtime")) - purrr::map_dfr(res$caches, ~.x) + purrr::list_rbind(purrr::map(res$caches, ~ tibble::as_tibble(.x))) } #' Delete a runtime cache diff --git a/R/tags.R b/R/tags.R index f48c49493..98e594932 100644 --- a/R/tags.R +++ b/R/tags.R @@ -472,7 +472,7 @@ tag_tree <- function(.x) { } parse_tags_tbl <- function(x) { - parsed_tags <- purrr::map_dfr( + parsed_tags <- purrr::list_rbind(purrr::map( x, ~ { out <- tibble::tibble( @@ -490,7 +490,7 @@ parse_tags_tbl <- function(x) { return(out) } - ) + )) return(parsed_tags) } From e8b044564de87e68373a7c98657097f83ce164bd Mon Sep 17 00:00:00 2001 From: Antoine Lachance-Perreault Date: Fri, 6 Feb 2026 14:13:15 -0500 Subject: [PATCH 2/2] rm accidental format edit --- R/get.R | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/R/get.R b/R/get.R index d9f9e76c1..ba39384e8 100644 --- a/R/get.R +++ b/R/get.R @@ -1056,11 +1056,7 @@ get_aws_credentials <- function(connect, user_session_token, audience = NULL) { #' } #' #' @export -get_aws_content_credentials <- function( - connect, - content_session_token = NULL, - audience = NULL -) { +get_aws_content_credentials <- function(connect, content_session_token = NULL, audience = NULL) { error_if_less_than(connect$version, "2025.03.0") if (!is.null(audience)) {