s3arch 0.0.4 → 0.0.6
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
- checksums.yaml.gz.sig +0 -0
- data/CHANGELOG.md +18 -0
- data/infrastructure/routes.tf.rb +8 -0
- data/infrastructure/schema.tf.rb +6 -0
- data/lambda/controllers/s3arch_controller.rb +54 -0
- data/lib/s3arch/configuration.rb +5 -0
- data/lib/s3arch/routes.rb +14 -0
- data/lib/s3arch/version.rb +1 -1
- data/lib/s3arch/web.rb +25 -0
- data/lib/s3arch.rb +1 -0
- data.tar.gz.sig +0 -0
- metadata +22 -3
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: f15baec2213fb6a5cee584447843884e1b9aa5e1bf650d500c53cd6c17e69539
|
|
4
|
+
data.tar.gz: d00b7d3345ebf462c5ef0a450452502a818c2dd6969c34e82bfc5d763dc9cd7f
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 3fd7108161529a4d4d23ffcd49e483d944064ea6364438470f65859c86382f43a611e6867a4d69981772c76bc6e244d306a256dbb1ac6607622cf787d78551e9
|
|
7
|
+
data.tar.gz: a9895ba3ef76d2720330633cc6eeb44e6d70d9a2461d4602eea136d8de19f4032397e1195dba91c1d0160a95a19bc69ec8123d2dd25581683da47a547717cd3e
|
checksums.yaml.gz.sig
CHANGED
|
Binary file
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,23 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [0.0.5] - 2025-06-12
|
|
4
|
+
|
|
5
|
+
### Added
|
|
6
|
+
|
|
7
|
+
- `S3arch::Dashboard` — mountable Rack application for viewing index stats (records, versions, owner counts)
|
|
8
|
+
- `S3arch::Dashboard::Application` — ERB-rendered HTML dashboard with mobile-friendly layout
|
|
9
|
+
- `S3arch::Holster` — Belt holster integration for convention-over-configuration mounting
|
|
10
|
+
- `S3arch::Routes` — Dispatcher mount DSL compatibility (`#routes` method)
|
|
11
|
+
- `S3arch::Web` — lightweight Rack entry point for Lambda integration
|
|
12
|
+
- `S3archController` — Belt controller for dashboard with Cognito auth gate
|
|
13
|
+
- `Configuration#dashboard_auth` — configurable authentication for dashboard access
|
|
14
|
+
- localStorage-based auth for CloudFront same-origin serving
|
|
15
|
+
|
|
16
|
+
### Changed
|
|
17
|
+
|
|
18
|
+
- Dashboard renders HTML via ERB instead of JSON
|
|
19
|
+
- Scientific notation fix for large record/version numbers in dashboard
|
|
20
|
+
|
|
3
21
|
## [0.0.4] - 2025-06-09
|
|
4
22
|
|
|
5
23
|
### Fixed
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'aws-sdk-dynamodb'
|
|
4
|
+
|
|
5
|
+
class S3archController < BeltController::Base
|
|
6
|
+
def index
|
|
7
|
+
owners = fetch_owners
|
|
8
|
+
success_response(owners: owners)
|
|
9
|
+
rescue StandardError => e
|
|
10
|
+
error_response("Failed to load owners: #{e.message}", 500)
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
def rebuild
|
|
14
|
+
owner_id = params['owner_id']&.strip
|
|
15
|
+
return error_response('owner_id is required', 400) if owner_id.nil? || owner_id.empty?
|
|
16
|
+
|
|
17
|
+
handler = S3arch.configuration.rebuild_handler
|
|
18
|
+
if handler
|
|
19
|
+
handler.call(owner_id)
|
|
20
|
+
else
|
|
21
|
+
S3arch::Indexer.new.rebuild(owner_id)
|
|
22
|
+
end
|
|
23
|
+
success_response(status: 'ok', owner_id: owner_id)
|
|
24
|
+
rescue StandardError => e
|
|
25
|
+
error_response("Failed to rebuild index: #{e.message}", 500)
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
private
|
|
29
|
+
|
|
30
|
+
def fetch_owners
|
|
31
|
+
dynamodb = Aws::DynamoDB::Client.new
|
|
32
|
+
config = S3arch.configuration
|
|
33
|
+
items = []
|
|
34
|
+
scan_params = { table_name: config.version_table }
|
|
35
|
+
|
|
36
|
+
loop do
|
|
37
|
+
result = dynamodb.scan(scan_params)
|
|
38
|
+
items.concat(result.items)
|
|
39
|
+
break unless result.last_evaluated_key
|
|
40
|
+
|
|
41
|
+
scan_params[:exclusive_start_key] = result.last_evaluated_key
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
owners = items.map do |item|
|
|
45
|
+
{
|
|
46
|
+
owner_id: item[config.owner_key] || item.values.first,
|
|
47
|
+
version: item['version'],
|
|
48
|
+
record_count: item['record_count'],
|
|
49
|
+
updated_at: item['updated_at']
|
|
50
|
+
}
|
|
51
|
+
end
|
|
52
|
+
owners.sort_by { |o| o[:updated_at].to_s }.reverse
|
|
53
|
+
end
|
|
54
|
+
end
|
data/lib/s3arch/configuration.rb
CHANGED
|
@@ -42,6 +42,11 @@ module S3arch
|
|
|
42
42
|
# Searcher settings
|
|
43
43
|
attr_accessor :version_ttl, :max_results, :max_cached_dbs, :ephemeral_storage_mb
|
|
44
44
|
|
|
45
|
+
# Custom rebuild handler — proc/lambda that receives owner_id.
|
|
46
|
+
# When set, the controller uses this instead of calling Indexer.new.rebuild directly.
|
|
47
|
+
# Useful for triggering rebuilds via Lambda invocation instead of in-process.
|
|
48
|
+
attr_accessor :rebuild_handler
|
|
49
|
+
|
|
45
50
|
def initialize
|
|
46
51
|
@owner_key = 'user_id'
|
|
47
52
|
@searchable_fields = %w[name description]
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module S3arch
|
|
4
|
+
# Lightweight route manifest for Dispatcher mount DSL.
|
|
5
|
+
# No heavy dependencies — safe to load in parse-only contexts.
|
|
6
|
+
module Routes
|
|
7
|
+
def self.routes
|
|
8
|
+
[
|
|
9
|
+
{ method: :get, path: '/' },
|
|
10
|
+
{ method: :post, path: '/rebuild' }
|
|
11
|
+
]
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
end
|
data/lib/s3arch/version.rb
CHANGED
data/lib/s3arch/web.rb
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
# Lightweight S3arch load for web/API contexts (no SQLite dependency).
|
|
4
|
+
# Provides configuration and routes only.
|
|
5
|
+
require_relative 'version'
|
|
6
|
+
require_relative 'configuration'
|
|
7
|
+
require_relative 'routes'
|
|
8
|
+
|
|
9
|
+
module S3arch
|
|
10
|
+
class Error < StandardError; end
|
|
11
|
+
|
|
12
|
+
class << self
|
|
13
|
+
def configuration
|
|
14
|
+
@configuration ||= Configuration.new
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
def configure
|
|
18
|
+
yield(configuration)
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
def reset_configuration!
|
|
22
|
+
@configuration = Configuration.new
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
end
|
data/lib/s3arch.rb
CHANGED
data.tar.gz.sig
CHANGED
|
Binary file
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: s3arch
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.0.
|
|
4
|
+
version: 0.0.6
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Adam Dalton
|
|
@@ -64,6 +64,20 @@ dependencies:
|
|
|
64
64
|
- - "~>"
|
|
65
65
|
- !ruby/object:Gem::Version
|
|
66
66
|
version: '1.0'
|
|
67
|
+
- !ruby/object:Gem::Dependency
|
|
68
|
+
name: rack
|
|
69
|
+
requirement: !ruby/object:Gem::Requirement
|
|
70
|
+
requirements:
|
|
71
|
+
- - ">="
|
|
72
|
+
- !ruby/object:Gem::Version
|
|
73
|
+
version: '2.0'
|
|
74
|
+
type: :runtime
|
|
75
|
+
prerelease: false
|
|
76
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
77
|
+
requirements:
|
|
78
|
+
- - ">="
|
|
79
|
+
- !ruby/object:Gem::Version
|
|
80
|
+
version: '2.0'
|
|
67
81
|
- !ruby/object:Gem::Dependency
|
|
68
82
|
name: sqlite3
|
|
69
83
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -78,8 +92,8 @@ dependencies:
|
|
|
78
92
|
- - "~>"
|
|
79
93
|
- !ruby/object:Gem::Version
|
|
80
94
|
version: '2.0'
|
|
81
|
-
description: Per-owner SQLite FTS5 indexes stored on S3, queried from Lambda /tmp
|
|
82
|
-
|
|
95
|
+
description: Per-owner SQLite FTS5 indexes stored on S3, queried from Lambda /tmp
|
|
96
|
+
with version tracking.
|
|
83
97
|
email:
|
|
84
98
|
- adam@stowzilla.com
|
|
85
99
|
executables: []
|
|
@@ -90,13 +104,18 @@ files:
|
|
|
90
104
|
- LICENSE.txt
|
|
91
105
|
- README.md
|
|
92
106
|
- certs/stowzilla.pem
|
|
107
|
+
- infrastructure/routes.tf.rb
|
|
108
|
+
- infrastructure/schema.tf.rb
|
|
109
|
+
- lambda/controllers/s3arch_controller.rb
|
|
93
110
|
- lib/s3arch.rb
|
|
94
111
|
- lib/s3arch/configuration.rb
|
|
95
112
|
- lib/s3arch/handler.rb
|
|
96
113
|
- lib/s3arch/indexer.rb
|
|
114
|
+
- lib/s3arch/routes.rb
|
|
97
115
|
- lib/s3arch/searcher.rb
|
|
98
116
|
- lib/s3arch/tokenizer.rb
|
|
99
117
|
- lib/s3arch/version.rb
|
|
118
|
+
- lib/s3arch/web.rb
|
|
100
119
|
homepage: https://github.com/stowzilla/s3arch
|
|
101
120
|
licenses:
|
|
102
121
|
- MIT
|
metadata.gz.sig
CHANGED
|
Binary file
|