sqlui 0.1.81 → 0.1.83

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0fb042a1aacd5fc454eaaada78d8fb9b7f3d5ac0da3790345c7342edc01d6b78
4
- data.tar.gz: 734bb0cb942c6e8e08b74f7242354d270f8ae65b94b5103455c532d461341b1a
3
+ metadata.gz: b5625b1229d609f4ed5ded6463cba24291b1dd606ea8fff44b64b8352b7eea00
4
+ data.tar.gz: 26d7083c243f813d8f4a592fac971cdd21de499ca83fdb434d3fc84139079d7e
5
5
  SHA512:
6
- metadata.gz: c51254fd5fd7f7cd0712408df40fc0a8f01ecc8c905ac77edf4ba43e6c6e6131154b7790f7bbe19424e6c478949b6d1718a10f9621016a2ee7cbff639f61fa0e
7
- data.tar.gz: 9473c16718a7743eb93d95ee05d6c51fbc1c21086033f89953264eeaf7c769f593a61f306523d38f437895f9c22662857a5cd78d36ff352650be255342c8bb09
6
+ metadata.gz: 9e017c148185dbc8514b26765bcf2a30628fe27f4e3a1052e54a7e9836c4a2f0028877f93a03d50b4684c505848dcd049dce8b28821c8823bf2352f4d8661af0
7
+ data.tar.gz: 7d6d9d3c7826fa9c6035564612b306352d6de09aaf6884049f79cdfed713bd9f522006f5bec3fb50f04937a41f51d3d4ff32e60939844aee06366874543352d8
data/.release-version CHANGED
@@ -1 +1 @@
1
- 0.1.81
1
+ 0.1.83
@@ -53,8 +53,8 @@ module Github
53
53
  latch = CountDownLatch.new(tree_size)
54
54
  response['tree'].each do |blob|
55
55
  TreeClient.thread_pool.post do
56
- blob['content'] =
57
- get_file_content_with_caching(owner: owner, repo: repo, path: blob['path'], ref: response['sha'])
56
+ blob_response = @client.get_with_caching(blob['url'], cache_for: DEFAULT_MAX_FILE_CACHE_AGE_SECONDS)
57
+ blob['content'] = Base64.decode64(blob_response['content'])
58
58
  ensure
59
59
  latch.count_down
60
60
  end
@@ -133,18 +133,5 @@ module Github
133
133
  }
134
134
  )
135
135
  end
136
-
137
- private
138
-
139
- # Returns the contents of the file at the specified path. Uses the cache.
140
- def get_file_content_with_caching(owner:, repo:, path:, ref:)
141
- check_non_empty_string(owner: owner, repo: repo, sha: ref, path: path)
142
-
143
- response = @client.get_with_caching(
144
- "https://api.github.com/repos/#{owner}/#{repo}/contents/#{path}?ref=#{ref}",
145
- cache_for: DEFAULT_MAX_FILE_CACHE_AGE_SECONDS
146
- )
147
- Base64.decode64(response['content'])
148
- end
149
136
  end
150
137
  end
data/app/server.rb CHANGED
@@ -123,7 +123,6 @@ class Server < Sinatra::Base
123
123
  )
124
124
  # Prefetch all trees on startup. This should happen before the health endpoint is available.
125
125
  unless ENV.fetch('DISABLE_PREFETCH', '0') == '1'
126
- Sqlui.logger.info 'prefetch'
127
126
  tree_client.get_tree(
128
127
  owner: saved_config.owner,
129
128
  repo: saved_config.repo,
@@ -379,7 +378,12 @@ class Server < Sinatra::Base
379
378
  return Github::Cache.new({}, logger: Sqlui.logger) unless ENV['USE_LOCAL_SAVED_FILES']
380
379
 
381
380
  paths = Dir.glob('sql/**/*.sql')
382
- blobs = paths.map { |path| { 'path' => path, 'sha' => 'foo' } }
381
+ blobs = paths.map do |path|
382
+ {
383
+ 'path' => path,
384
+ 'url' => "https://api.github.com/repos/nicholasdower/sqlui/git/blobs/#{Base64.encode64(path)}"
385
+ }
386
+ end
383
387
  github_cache_hash = {
384
388
  'https://api.github.com/repos/nicholasdower/sqlui/git/trees/master?recursive=true' =>
385
389
  Github::Cache::Entry.new(
@@ -391,7 +395,7 @@ class Server < Sinatra::Base
391
395
  )
392
396
  }
393
397
  paths.each do |path|
394
- github_cache_hash["https://api.github.com/repos/nicholasdower/sqlui/contents/#{path}?ref=foo"] =
398
+ github_cache_hash["https://api.github.com/repos/nicholasdower/sqlui/git/blobs/#{Base64.encode64(path)}"] =
395
399
  Github::Cache::Entry.new(
396
400
  {
397
401
  'content' => Base64.encode64(File.read(path))
@@ -24931,12 +24931,12 @@
24931
24931
 
24932
24932
  addEventListener('#submit-dropdown-button-copy-csv', 'click', () => {
24933
24933
  if (window.sqlFetch?.result) {
24934
- copyTextToClipboard(toCsv(window.sqlFetch.result.columns, window.sqlFetch.result.rows));
24934
+ copyTextToClipboard(toCsv(window.sqlFetch.result.columns, window.sqlFetch.result.rows) + '\n');
24935
24935
  }
24936
24936
  });
24937
24937
  addEventListener('#submit-dropdown-button-copy-tsv', 'click', () => {
24938
24938
  if (window.sqlFetch?.result) {
24939
- copyTextToClipboard(toTsv(window.sqlFetch.result.columns, window.sqlFetch.result.rows));
24939
+ copyTextToClipboard(toTsv(window.sqlFetch.result.columns, window.sqlFetch.result.rows) + '\n');
24940
24940
  }
24941
24941
  });
24942
24942
  addEventListener('#first-button', 'click', () => {
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sqlui
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.81
4
+ version: 0.1.83
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nick Dower
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-07-10 00:00:00.000000000 Z
11
+ date: 2023-07-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport