strata-cli 0.1.16 → 0.1.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +6 -0
- data/lib/strata/cli/api/client.rb +6 -0
- data/lib/strata/cli/main.rb +4 -0
- data/lib/strata/cli/sub_commands/cache.rb +50 -0
- data/lib/strata/cli/version.rb +1 -1
- metadata +2 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 0eed3ab022a70f7362fef36cecee35c47cb9a8e3f86845d2cbc6ed58e4212f16
|
|
4
|
+
data.tar.gz: d14df20e4a614d79640a874868d1d819a477cf21bd67ba9f4be8fbe64576db83
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 290d7b617d7bfb883d1e268d06447aeaa975015293c2b68e062132393d5dc8f8d1e1d846045c292dfd2956737cd744523ab21544d5a739dc232f93cec1d28027
|
|
7
|
+
data.tar.gz: 3e20c5dc5ce59f4757ad028c5ab89fe15403b56b386afc6c34b46af8ea53f4d28a99f8cb7786a3d7e23ea518bc848206d29bda461589cebb8b88bcb5eb3102a1
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
## [Unreleased]
|
|
2
2
|
|
|
3
|
+
## [0.1.17] - 2026-09-09
|
|
4
|
+
|
|
5
|
+
### Added
|
|
6
|
+
|
|
7
|
+
- **Cache purge command**: `strata cache purge` purges all cached query results for the project on the Strata server. Confirms before purging unless `--yes` is passed, then prints the number of queued result sets.
|
|
8
|
+
|
|
3
9
|
## [0.1.16] - 2026-09-05
|
|
4
10
|
|
|
5
11
|
### Added
|
|
@@ -102,6 +102,12 @@ module Strata
|
|
|
102
102
|
handle_response(response)
|
|
103
103
|
end
|
|
104
104
|
|
|
105
|
+
def purge_cache(project_id)
|
|
106
|
+
url = "#{@server_url}/api/v1/projects/#{project_id}/cache"
|
|
107
|
+
response = with_connection_error_handling(@server_url) { connection.delete(url) }
|
|
108
|
+
handle_response(response)
|
|
109
|
+
end
|
|
110
|
+
|
|
105
111
|
private
|
|
106
112
|
|
|
107
113
|
def connection
|
data/lib/strata/cli/main.rb
CHANGED
|
@@ -8,6 +8,7 @@ require_relative "sub_commands/project"
|
|
|
8
8
|
require_relative "sub_commands/table"
|
|
9
9
|
require_relative "sub_commands/create"
|
|
10
10
|
require_relative "sub_commands/audit"
|
|
11
|
+
require_relative "sub_commands/cache"
|
|
11
12
|
require_relative "helpers/description_helper"
|
|
12
13
|
require_relative "agent_mode"
|
|
13
14
|
require_relative "output"
|
|
@@ -74,6 +75,9 @@ module Strata
|
|
|
74
75
|
desc "project", "Manage project configuration"
|
|
75
76
|
subcommand "project", SubCommands::Project
|
|
76
77
|
|
|
78
|
+
desc "cache", "Manage cached query results"
|
|
79
|
+
subcommand "cache", SubCommands::Cache
|
|
80
|
+
|
|
77
81
|
# Creating aliases
|
|
78
82
|
map "t" => "table"
|
|
79
83
|
map "tbl" => "table"
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require_relative "../guard"
|
|
4
|
+
require_relative "../output"
|
|
5
|
+
require_relative "../api/client"
|
|
6
|
+
require "tty-prompt"
|
|
7
|
+
require_relative "../agent_mode"
|
|
8
|
+
|
|
9
|
+
module Strata
|
|
10
|
+
module CLI
|
|
11
|
+
module SubCommands
|
|
12
|
+
class Cache < Thor
|
|
13
|
+
include Guard
|
|
14
|
+
include Output
|
|
15
|
+
include AgentMode
|
|
16
|
+
|
|
17
|
+
class_option :environment, aliases: ["e"], type: :string
|
|
18
|
+
|
|
19
|
+
desc "purge", "Purge all cached query results on the Strata server"
|
|
20
|
+
method_option :yes, aliases: ["y"], type: :boolean, default: false, desc: "Skip confirmation."
|
|
21
|
+
def purge
|
|
22
|
+
config = CLI.config.get_for_environment(options[:environment])
|
|
23
|
+
%w[server api_key project_id].each { |key| ensure_config_present(config, key) }
|
|
24
|
+
|
|
25
|
+
return unless confirm_purge
|
|
26
|
+
|
|
27
|
+
result = API::Client.new(config["server"], config["api_key"]).purge_cache(config["project_id"])
|
|
28
|
+
print_success("Queued purge of #{result["count"]} cached result set(s).")
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
private
|
|
32
|
+
|
|
33
|
+
def ensure_config_present(config, key)
|
|
34
|
+
return if config[key] && !config[key].to_s.strip.empty?
|
|
35
|
+
|
|
36
|
+
raise Strata::CommandError, "Missing required configuration: #{key}. Check your project.yml or .strata file."
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
def confirm_purge
|
|
40
|
+
return true if options[:yes]
|
|
41
|
+
|
|
42
|
+
return true if TTY::Prompt.new.yes?("Purge all cached query results on the server?")
|
|
43
|
+
|
|
44
|
+
print_warning("Purge cancelled.")
|
|
45
|
+
false
|
|
46
|
+
end
|
|
47
|
+
end
|
|
48
|
+
end
|
|
49
|
+
end
|
|
50
|
+
end
|
data/lib/strata/cli/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: strata-cli
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.1.
|
|
4
|
+
version: 0.1.17
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Ajo Abraham
|
|
@@ -305,6 +305,7 @@ files:
|
|
|
305
305
|
- lib/strata/cli/output.rb
|
|
306
306
|
- lib/strata/cli/sub_commands/audit.rb
|
|
307
307
|
- lib/strata/cli/sub_commands/branch.rb
|
|
308
|
+
- lib/strata/cli/sub_commands/cache.rb
|
|
308
309
|
- lib/strata/cli/sub_commands/create.rb
|
|
309
310
|
- lib/strata/cli/sub_commands/datasource.rb
|
|
310
311
|
- lib/strata/cli/sub_commands/deploy.rb
|