atlas_rb 1.7.0 → 1.8.1
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/.version +1 -1
- data/CHANGELOG.md +11 -0
- data/Gemfile.lock +1 -1
- data/lib/atlas_rb/blob.rb +43 -0
- data/lib/atlas_rb/work.rb +36 -0
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: de8129aceabcd06af713b7bddf2e4be8ff259bc3f8095af41d9e63cc2f03c17b
|
|
4
|
+
data.tar.gz: 9a45c13597c30c4b0c09c9dfb0bf199edb7d919d050f10faaadc32cc2024af3b
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: ee4d49599431a9052c3f3bc55d2d336bb967fedc61edb2815dda42cee74d2250b6700a51ea88c5b74a959fe2f562923e4486831bba66ceb7d5b0236fa74b054c
|
|
7
|
+
data.tar.gz: 75e2208c86cc1d3e6e13a1bcde956d2d821a7e6e5a141004b2bc2743b550778bd621bcc70aed2528122fabcb931f60a2bc356ed99226a9ece39b125b4d3a3f09
|
data/.version
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
1.
|
|
1
|
+
1.8.1
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,16 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 1.8.0
|
|
4
|
+
|
|
5
|
+
### Added — `Work.set_full_text` (full-text search seam)
|
|
6
|
+
|
|
7
|
+
`Work.set_full_text(id, text:)` → `PATCH /works/:id/full_text`. Hands Atlas the
|
|
8
|
+
Work-level aggregate of Cerberus-extracted document text; Atlas stores it as the
|
|
9
|
+
Work's derived `full_text` and projects it onto the Work's Solr doc
|
|
10
|
+
(`all_text_timv`) for body-text search and the "Full Text Match" snippet. Same
|
|
11
|
+
"machine-set derived metadata" family as `set_thumbnails` / `set_image_derivatives`
|
|
12
|
+
— a regenerable search aid re-sent on any re-ingest, not user-authored content.
|
|
13
|
+
|
|
3
14
|
## 1.7.0
|
|
4
15
|
|
|
5
16
|
### Added — binary version read surface (`Blob.versions` / `version_content` / `rollback`)
|
data/Gemfile.lock
CHANGED
data/lib/atlas_rb/blob.rb
CHANGED
|
@@ -39,6 +39,49 @@ module AtlasRb
|
|
|
39
39
|
))['blob']
|
|
40
40
|
end
|
|
41
41
|
|
|
42
|
+
# Resolve a content Blob to its parent FileSet and containing Work noids.
|
|
43
|
+
#
|
|
44
|
+
# Wraps `GET /files/<id>/ancestry`. The download path is keyed only by the
|
|
45
|
+
# blob id, so a consumer recording a download/stream impression against the
|
|
46
|
+
# containing Work resolves it here — instead of threading the work noid
|
|
47
|
+
# through the download URL. Reads on the Blob floor (no admin gate). An
|
|
48
|
+
# unknown id yields a `404` (raw Faraday response); either value is `nil`
|
|
49
|
+
# when unresolvable (e.g. an orphan blob with no FileSet parent).
|
|
50
|
+
#
|
|
51
|
+
# @param id [String] the Blob ID.
|
|
52
|
+
# @param nuid [String, nil] optional acting user's NUID. On the relay-signing
|
|
53
|
+
# path it is signed into the assertion `sub`; on the BYO-JWT (`ATLAS_JWT`)
|
|
54
|
+
# path it is ignored (identity lives in the token).
|
|
55
|
+
# @param on_behalf_of [String, nil] optional NUID for the `On-Behalf-Of`
|
|
56
|
+
# header. Falls through to {AtlasRb.config}.default_on_behalf_of when
|
|
57
|
+
# omitted.
|
|
58
|
+
# @return [AtlasRb::Mash] `{ "file_set" => "<noid>", "work" => "<noid>" }`
|
|
59
|
+
# (either value `nil` when unresolvable).
|
|
60
|
+
#
|
|
61
|
+
# @example
|
|
62
|
+
# AtlasRb::Blob.ancestry("b-321")
|
|
63
|
+
# # => { "file_set" => "fs-654", "work" => "w-789" }
|
|
64
|
+
def self.ancestry(id, nuid: nil, on_behalf_of: nil)
|
|
65
|
+
AtlasRb::Mash.new(JSON.parse(
|
|
66
|
+
connection({}, nuid, on_behalf_of: on_behalf_of).get("#{ROUTE}#{id}/ancestry")&.body
|
|
67
|
+
))
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
# Convenience over {.ancestry}: the containing Work's noid for a content
|
|
71
|
+
# Blob (or `nil` when unresolvable). The shape Cerberus's impression-capture
|
|
72
|
+
# job wants — roll a download up to its Work from the blob id alone.
|
|
73
|
+
#
|
|
74
|
+
# @param id [String] the Blob ID.
|
|
75
|
+
# @param nuid [String, nil] optional acting user's NUID (see {.ancestry}).
|
|
76
|
+
# @param on_behalf_of [String, nil] optional `On-Behalf-Of` NUID (see {.ancestry}).
|
|
77
|
+
# @return [String, nil] the containing Work's noid, or `nil` when unresolvable.
|
|
78
|
+
#
|
|
79
|
+
# @example
|
|
80
|
+
# AtlasRb::Blob.work("b-321") # => "w-789"
|
|
81
|
+
def self.work(id, nuid: nil, on_behalf_of: nil)
|
|
82
|
+
ancestry(id, nuid: nuid, on_behalf_of: on_behalf_of)['work']
|
|
83
|
+
end
|
|
84
|
+
|
|
42
85
|
# Stream the Blob's binary content through a caller-supplied block.
|
|
43
86
|
#
|
|
44
87
|
# The body is **not** buffered — each chunk Faraday receives is yielded
|
data/lib/atlas_rb/work.rb
CHANGED
|
@@ -344,6 +344,42 @@ module AtlasRb
|
|
|
344
344
|
))
|
|
345
345
|
end
|
|
346
346
|
|
|
347
|
+
# Store a Work's derived full-document text for search indexing.
|
|
348
|
+
#
|
|
349
|
+
# Purpose-specific PATCH in the same "machine-set derived metadata" family
|
|
350
|
+
# as {.set_thumbnails} / {.set_image_derivatives}. Hand Atlas the Work-level
|
|
351
|
+
# aggregate of the extracted body text (the concatenation of the Work's
|
|
352
|
+
# content FileSets' text); Atlas stores it as the Work's derived `full_text`
|
|
353
|
+
# and its `FullTextIndexer` projects it onto the Work's Solr doc
|
|
354
|
+
# (`all_text_timv`) for body-text search + the "Full Text Match" snippet.
|
|
355
|
+
#
|
|
356
|
+
# Distinct from {.metadata} — this is a machine-extracted search aid
|
|
357
|
+
# (pdftotext / Tika in a Cerberus job), not user-authored descriptive
|
|
358
|
+
# content, and is re-sent on any re-ingest. Empty/blank text clears it.
|
|
359
|
+
#
|
|
360
|
+
# @param id [String] the Work ID.
|
|
361
|
+
# @param text [String] the extracted plain text (Work-level aggregate).
|
|
362
|
+
# @param nuid [String, nil] optional acting user's NUID. On the relay-signing
|
|
363
|
+
# path it is signed into the assertion `sub`; on the BYO-JWT (`ATLAS_JWT`)
|
|
364
|
+
# path it is ignored (identity lives in the token).
|
|
365
|
+
# @param on_behalf_of [String, nil] optional NUID for the `On-Behalf-Of`
|
|
366
|
+
# header. Falls through to {AtlasRb.config}.default_on_behalf_of when
|
|
367
|
+
# omitted.
|
|
368
|
+
# @return [AtlasRb::Mash] the parsed JSON response (the Work; the stored text
|
|
369
|
+
# is not echoed back — it's read only through Solr).
|
|
370
|
+
# @raise [AtlasRb::StaleResourceError] if Atlas reports an optimistic-lock
|
|
371
|
+
# conflict that exhausted its internal retry budget (HTTP 409 with
|
|
372
|
+
# `error: "stale_resource"`).
|
|
373
|
+
#
|
|
374
|
+
# @example
|
|
375
|
+
# AtlasRb::Work.set_full_text("w-789", text: extracted_pdf_text)
|
|
376
|
+
def self.set_full_text(id, text:, nuid: nil, on_behalf_of: nil)
|
|
377
|
+
AtlasRb::Mash.new(JSON.parse(
|
|
378
|
+
connection({}, nuid, on_behalf_of: on_behalf_of)
|
|
379
|
+
.patch(ROUTE + id + '/full_text', JSON.dump(text: text))&.body
|
|
380
|
+
))
|
|
381
|
+
end
|
|
382
|
+
|
|
347
383
|
# List the assets attached to a Work — {Blob}s and {Delegate}s alike.
|
|
348
384
|
#
|
|
349
385
|
# Useful for building download UIs — the response includes enough to
|
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.
|
|
4
|
+
version: 1.8.1
|
|
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-
|
|
11
|
+
date: 2026-06-25 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: faraday
|