atlas_rb 1.6.1 → 1.6.2

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: f0b6def06432136a4f0fda238a5c8ff3599de63234325e8609d0fcc49012d42d
4
- data.tar.gz: a50c8fbbcaa1776a171f199e86e5ab90a8034f8c9415547c97893f52dc26a449
3
+ metadata.gz: d84aa1546173f2a0ad397f7bb8f960be544c79c02187013fadf82301efa8afcf
4
+ data.tar.gz: 7873dec712e7bc46d10fd081e2401a96ff980c3c93d97a35799f08edbe701f26
5
5
  SHA512:
6
- metadata.gz: 19578a460cb38f49fd97a7513cc2ba6d782fa260a82f3c1071cc88e01a6a21ad6026969422033af5ad013f3e81d2d4d400fab42c72b300bd410582dc806d7f29
7
- data.tar.gz: 941ce0caf062890a63891e5a458d83e1300e9240240f8adaf39a9e7ed7879ddaf4ef8168c566b052c5c7f7fde50c66e00e93baa66f71462a5464f2ea1b4a03ad
6
+ metadata.gz: 431d703701ca9f01511894590c3680147f96daf702930796acc8bfe6678b7c34eba571087c6ce491daf144797ea2c07bfd345e04d20cf077ff92034ec2c0c886
7
+ data.tar.gz: 83dc3bd542faa2ccca914f0f4029f4ef5427fd0971c641edeeacf607927d93d818e71faa45c9b5637f7f6ed9df0df7600a66bfa420a86965d3a59f71726d4b64
data/.version CHANGED
@@ -1 +1 @@
1
- 1.6.1
1
+ 1.6.2
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- atlas_rb (1.6.1)
4
+ atlas_rb (1.6.2)
5
5
  faraday (~> 2.7)
6
6
  faraday-follow_redirects (~> 0.3.0)
7
7
  faraday-multipart (~> 1)
@@ -0,0 +1,58 @@
1
+ # frozen_string_literal: true
2
+
3
+ module AtlasRb
4
+ # System-context callers — see {AtlasRb::System::User} for the namespace
5
+ # rationale (separate bearer token, hard-pinned `User:` header, the class
6
+ # itself as the carve-out marker).
7
+ #
8
+ # Beyond user provisioning, the namespace exposes Atlas's operational,
9
+ # `:system`-gated maintenance actions. These are not user operations — they
10
+ # never appear on the human CRUD surface — so they ride the system path.
11
+ module System
12
+ extend AtlasRb::FaradayHelper
13
+
14
+ # Re-project a single resource's Solr doc from Atlas's current
15
+ # Postgres/OCFL state. Solr-only on the server — no lifecycle transition,
16
+ # no audit event, no optimistic-lock bump. The purpose-built lever for
17
+ # refreshing a stale projection after an indexer ships or changes (e.g.
18
+ # the catalog's `classification_ssim` "Content" facet), without abusing
19
+ # `AtlasRb::Work.complete` to nudge Solr as a finalize side effect.
20
+ #
21
+ # Idempotent. Authenticates as the Atlas `:system` fixture via
22
+ # {FaradayHelper#system_connection}, so there is no way to issue it as a
23
+ # regular user.
24
+ #
25
+ # @param id [String] the NOID of any resource (Work, Collection,
26
+ # Community, FileSet, ...).
27
+ # @return [Faraday::Response] the raw response. Status `204` on success;
28
+ # `404` if the id does not resolve.
29
+ #
30
+ # @example Refresh one drifted Work after a new indexer shipped
31
+ # AtlasRb::System.reindex("neu:abc123")
32
+ def self.reindex(id)
33
+ system_connection.post("/resources/#{id}/reindex")
34
+ end
35
+
36
+ # Re-project a resource AND its full descendant subtree — descendant
37
+ # containers (Collection/Community) plus the Works beneath them, a superset
38
+ # of Atlas's re-parent cascade so Work-level projections refresh too. Same
39
+ # Solr-only, side-effect-free semantics as {.reindex}.
40
+ #
41
+ # Synchronous on the server: rooted at a Collection it refreshes that
42
+ # Collection's contents; rooted at the top Community it backfills the whole
43
+ # repository. For a pathologically large subtree, root lower or drive the
44
+ # cascade in chunks (repeated calls) rather than relying on Atlas to grow a
45
+ # job runner — bulk orchestration lives in the consumer.
46
+ #
47
+ # @param id [String] the NOID of the subtree root.
48
+ # @return [Integer] the number of resources re-projected (the server's
49
+ # `reindexed` count).
50
+ #
51
+ # @example Backfill a Collection's contents after an indexer change
52
+ # AtlasRb::System.reindex_subtree("neu:collection1") # => 42
53
+ def self.reindex_subtree(id)
54
+ response = system_connection.post("/resources/#{id}/reindex_subtree")
55
+ JSON.parse(response.body)["reindexed"]
56
+ end
57
+ end
58
+ end
data/lib/atlas_rb.rb CHANGED
@@ -27,6 +27,7 @@ require_relative "atlas_rb/admin"
27
27
  require_relative "atlas_rb/admin/work"
28
28
  require_relative "atlas_rb/admin/collection"
29
29
  require_relative "atlas_rb/admin/community"
30
+ require_relative "atlas_rb/system"
30
31
  require_relative "atlas_rb/system/user"
31
32
  require_relative "atlas_rb/audit_event"
32
33
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: atlas_rb
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.6.1
4
+ version: 1.6.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Cliff
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2026-06-16 00:00:00.000000000 Z
11
+ date: 2026-06-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -148,6 +148,7 @@ files:
148
148
  - lib/atlas_rb/middleware/raise_on_resource_error.rb
149
149
  - lib/atlas_rb/middleware/raise_on_stale_resource.rb
150
150
  - lib/atlas_rb/resource.rb
151
+ - lib/atlas_rb/system.rb
151
152
  - lib/atlas_rb/system/user.rb
152
153
  - lib/atlas_rb/user.rb
153
154
  - lib/atlas_rb/version.rb