atlas_rb 1.28.0 → 1.29.0
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 +27 -0
- data/Gemfile.lock +1 -1
- data/README.md +2 -2
- data/lib/atlas_rb/admin/resource.rb +4 -4
- data/lib/atlas_rb/admin.rb +1 -1
- data/lib/atlas_rb/resource_writes.rb +5 -5
- data/lib/atlas_rb/work.rb +54 -12
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 992d6ea2f49be14d9163123932c11e9f150751ced8e3261ef08c532879177230
|
|
4
|
+
data.tar.gz: 001b33d6eb73fb1b3cbcc2fc5e066ea0b1ccf5b0bae29455eafb1da0fd68036d
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: c12109d7c7cda3ab19f6b41d1849c8085fd30b54a1a638a0848fcc039e46f5745b14686fbfab3a2df8390be10122278e3693dc16eb2f5f9f681383715e7ba203
|
|
7
|
+
data.tar.gz: 0da824372eb26beccf7b0bbb5230a6b446bc0379142b7339b228bf1364580ac19a94f3021879cd9027270539e8ad4f9f0915a7a61fd8e7f1464e474445a7a479
|
data/.version
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
1.
|
|
1
|
+
1.29.0
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,32 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 1.29.0
|
|
4
|
+
|
|
5
|
+
Requires an Atlas that serves `GET /works/:id/tombstoned_assets` (0.6.244 or
|
|
6
|
+
later). Against an older Atlas the method answers `nil`, because that Atlas
|
|
7
|
+
answers `404` on the new path.
|
|
8
|
+
|
|
9
|
+
### Renamed — `Work.withdrawn_assets` is now `Work.tombstoned_assets`
|
|
10
|
+
|
|
11
|
+
Follows Atlas's rename of `GET /works/:id/withdrawn_assets`. The signature, the
|
|
12
|
+
return shape and the errors are unchanged, and no alias is kept. The YARD text
|
|
13
|
+
says "tombstone" for the reversible removal throughout, for a whole resource,
|
|
14
|
+
a single file and a Darwin Core record alike.
|
|
15
|
+
|
|
16
|
+
## 1.28.1
|
|
17
|
+
|
|
18
|
+
Requires an Atlas that serves `GET /works/:id/file_revisions` (0.6.243 or
|
|
19
|
+
later).
|
|
20
|
+
|
|
21
|
+
### Added — `AtlasRb::Work.file_revisions`
|
|
22
|
+
|
|
23
|
+
Lists the revision dates of a Work's replaced files: one entry per Blob with
|
|
24
|
+
more than one revision, as `blob_id` and `revisions`, newest first. Each
|
|
25
|
+
revision carries only `revision` and `created`. Atlas allows it to anyone who
|
|
26
|
+
can read the Work, so it carries no attribution; `Blob.versions` stays the
|
|
27
|
+
admin-gated, attributed history. `[]` when no file was ever replaced, `nil` on
|
|
28
|
+
a 404.
|
|
29
|
+
|
|
3
30
|
## 1.28.0
|
|
4
31
|
|
|
5
32
|
Requires an Atlas that stores the preview image's size and placeholder (0.6.234
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
|
@@ -284,7 +284,7 @@ radius and the kind of authentication they need:
|
|
|
284
284
|
```ruby
|
|
285
285
|
# Regular daily use — picks up Current.nuid via the configured default:
|
|
286
286
|
AtlasRb::Work.find("w-789") # typed read
|
|
287
|
-
AtlasRb::Resource.tombstone("w-789") #
|
|
287
|
+
AtlasRb::Resource.tombstone("w-789") # tombstone (reversible), any type
|
|
288
288
|
|
|
289
289
|
# Operator-only, with a friction marker:
|
|
290
290
|
AtlasRb::Admin::Resource.destroy("w-789", confirm: :i_understand)
|
|
@@ -541,7 +541,7 @@ if work["metadata_formats"].include?("dwc")
|
|
|
541
541
|
end
|
|
542
542
|
|
|
543
543
|
AtlasRb::Resource.put_dwc("w-789", "/tmp/dwc.xml", origin: "xml_loader")
|
|
544
|
-
AtlasRb::Resource.delete_dwc("w-789") #
|
|
544
|
+
AtlasRb::Resource.delete_dwc("w-789") # tombstones; the next put_dwc restores
|
|
545
545
|
|
|
546
546
|
history = AtlasRb::Resource.dwc_versions("w-789")
|
|
547
547
|
AtlasRb::Resource.dwc_version("w-789", history["versions"].last["version_id"])
|
|
@@ -17,7 +17,7 @@ module AtlasRb
|
|
|
17
17
|
# @api private
|
|
18
18
|
ROUTE = "/resources/"
|
|
19
19
|
|
|
20
|
-
# Hard-delete a resource — a purge, not a
|
|
20
|
+
# Hard-delete a resource — a purge, not a tombstone.
|
|
21
21
|
#
|
|
22
22
|
# Removes the resource's metadata, cascades into its members, and removes
|
|
23
23
|
# the OCFL objects holding the preserved bytes: every retained revision,
|
|
@@ -25,7 +25,7 @@ module AtlasRb
|
|
|
25
25
|
# records the NOIDs it removed.
|
|
26
26
|
#
|
|
27
27
|
# Unrecoverable — prefer {AtlasRb::Resource.tombstone} for the
|
|
28
|
-
# user-visible
|
|
28
|
+
# reversible, user-visible removal, which keeps everything and can be
|
|
29
29
|
# reversed. Admin-only.
|
|
30
30
|
#
|
|
31
31
|
# @param id [String] the resource's NOID.
|
|
@@ -49,11 +49,11 @@ module AtlasRb
|
|
|
49
49
|
|
|
50
50
|
# Restore a previously-tombstoned resource.
|
|
51
51
|
#
|
|
52
|
-
# Reverses a
|
|
52
|
+
# Reverses a tombstone: search and show pages stop returning a tombstoned
|
|
53
53
|
# stub. No `confirm:` marker — restoring is itself reversible, by
|
|
54
54
|
# tombstoning again.
|
|
55
55
|
#
|
|
56
|
-
# Accepts a FileSet id too (Atlas 0.6.211 or later), which puts a
|
|
56
|
+
# Accepts a FileSet id too (Atlas 0.6.211 or later), which puts a tombstoned
|
|
57
57
|
# caption or other attached file back in {Work.assets}.
|
|
58
58
|
#
|
|
59
59
|
# The devolved-admin tier calls this as well, although the namespace reads
|
data/lib/atlas_rb/admin.rb
CHANGED
|
@@ -5,7 +5,7 @@ module AtlasRb
|
|
|
5
5
|
#
|
|
6
6
|
# Houses methods whose blast radius warrants more friction than the
|
|
7
7
|
# regular CRUD surface: `destroy` (hard delete — content and metadata
|
|
8
|
-
# are unrecoverable) and `restore` (un-tombstone — reverses a
|
|
8
|
+
# are unrecoverable) and `restore` (un-tombstone — reverses a tombstone,
|
|
9
9
|
# typically driven from a Rails console session or a future admin UI).
|
|
10
10
|
#
|
|
11
11
|
# ## Why a separate namespace
|
|
@@ -83,7 +83,7 @@ module AtlasRb
|
|
|
83
83
|
))
|
|
84
84
|
end
|
|
85
85
|
|
|
86
|
-
#
|
|
86
|
+
# Tombstone a Work's Darwin Core record.
|
|
87
87
|
#
|
|
88
88
|
# Nothing is purged: Atlas keeps the document and its version history, and
|
|
89
89
|
# the next {put_dwc} restores the record. Until then {Work.dwc} answers
|
|
@@ -93,7 +93,7 @@ module AtlasRb
|
|
|
93
93
|
# @param nuid [String, nil] optional acting user's NUID.
|
|
94
94
|
# @param on_behalf_of [String, nil] optional NUID for the `On-Behalf-Of`
|
|
95
95
|
# header.
|
|
96
|
-
# @return [true] when the record was
|
|
96
|
+
# @return [true] when the record was tombstoned.
|
|
97
97
|
# @raise [AtlasRb::NotFoundError] on `404` — the Work holds no record, or
|
|
98
98
|
# the id is not a Work.
|
|
99
99
|
# @raise [AtlasRb::ResourceError] on any other non-2xx.
|
|
@@ -200,7 +200,7 @@ module AtlasRb
|
|
|
200
200
|
# Restore is the operator's counterpart and lives in
|
|
201
201
|
# {AtlasRb::Admin::Resource}, where the namespace is the marker.
|
|
202
202
|
#
|
|
203
|
-
# Tombstone
|
|
203
|
+
# Tombstone a resource: retract it from discovery, reversibly.
|
|
204
204
|
#
|
|
205
205
|
# Returns the **raw response** rather than raising, because Atlas refuses a
|
|
206
206
|
# container that still holds live children with a `422` carrying
|
|
@@ -208,13 +208,13 @@ module AtlasRb
|
|
|
208
208
|
# error. Reversible via {.restore}.
|
|
209
209
|
#
|
|
210
210
|
# Accepts a FileSet id as well as a Community, Collection or Work (Atlas
|
|
211
|
-
# 0.6.211 or later). That
|
|
211
|
+
# 0.6.211 or later). That tombstones an attached file, such as a caption,
|
|
212
212
|
# reversibly: its Blobs ride along and it drops out of {Work.assets} and
|
|
213
213
|
# {Work.file_sets}. Atlas refuses a FileSet from anyone outside the admin and
|
|
214
214
|
# devolved-admin tiers with `403`, even a user who can edit the Work.
|
|
215
215
|
#
|
|
216
216
|
# `reason:` records why the resource was removed (Atlas 0.6.213 or later).
|
|
217
|
-
# It must be one of the removal notes the library's
|
|
217
|
+
# It must be one of the removal notes the library's removal policy
|
|
218
218
|
# allows, word for word; Atlas answers `422` with `invalid_reason` for any
|
|
219
219
|
# other value. The note carries no date: read `tombstoned_at` for that.
|
|
220
220
|
# The resource returns it as `tombstone_reason`, and a restore clears it.
|
data/lib/atlas_rb/work.rb
CHANGED
|
@@ -447,12 +447,12 @@ module AtlasRb
|
|
|
447
447
|
#
|
|
448
448
|
# A Blob entry also carries `language` and `track_label`, set by {Blob.create}
|
|
449
449
|
# and {Blob.update} for a caption or other text track and `nil` otherwise
|
|
450
|
-
# (Atlas 0.6.211 or later). A FileSet
|
|
451
|
-
# drops out of this listing and {.file_sets}; {.
|
|
450
|
+
# (Atlas 0.6.211 or later). A FileSet tombstoned with {Resource.tombstone}
|
|
451
|
+
# drops out of this listing and {.file_sets}; {.tombstoned_assets} lists it.
|
|
452
452
|
#
|
|
453
453
|
# Every entry carries `file_set`, the NOID of the FileSet it is listed
|
|
454
454
|
# under (Atlas 0.6.212 or later). That is the id {Resource.tombstone} and
|
|
455
|
-
# {Admin::Resource.restore} take to
|
|
455
|
+
# {Admin::Resource.restore} take to tombstone or restore the file.
|
|
456
456
|
#
|
|
457
457
|
# @param id [String] the Work ID.
|
|
458
458
|
# @param nuid [String, nil] optional acting user's NUID. On the relay-signing
|
|
@@ -477,10 +477,10 @@ module AtlasRb
|
|
|
477
477
|
end
|
|
478
478
|
end
|
|
479
479
|
|
|
480
|
-
# List the assets of a Work's
|
|
480
|
+
# List the assets of a Work's tombstoned FileSets, so they can be restored.
|
|
481
481
|
#
|
|
482
|
-
# Wraps `GET /works/<id>/
|
|
483
|
-
# FileSet
|
|
482
|
+
# Wraps `GET /works/<id>/tombstoned_assets` (Atlas 0.6.244 or later). A
|
|
483
|
+
# FileSet tombstoned with {Resource.tombstone} drops out of {.assets} and
|
|
484
484
|
# {.file_sets}; this is the listing that still names it. Each entry has the
|
|
485
485
|
# {.assets} shape, including `file_set` (the id to pass to
|
|
486
486
|
# {Admin::Resource.restore}), plus the FileSet's `tombstoned_at` and
|
|
@@ -496,8 +496,8 @@ module AtlasRb
|
|
|
496
496
|
# @param on_behalf_of [String, nil] optional NUID for the `On-Behalf-Of`
|
|
497
497
|
# header. Falls through to {AtlasRb.config}.default_on_behalf_of when
|
|
498
498
|
# omitted.
|
|
499
|
-
# @return [Array<AtlasRb::Mash>, nil] one entry per asset of a
|
|
500
|
-
# FileSet; `[]` when nothing is
|
|
499
|
+
# @return [Array<AtlasRb::Mash>, nil] one entry per asset of a tombstoned
|
|
500
|
+
# FileSet; `[]` when nothing is tombstoned.
|
|
501
501
|
#
|
|
502
502
|
# `nil` when Atlas answers `404` — nothing is there to read, or, with a
|
|
503
503
|
# misconfigured `ATLAS_URL`, the route is not Atlas's at all.
|
|
@@ -506,11 +506,53 @@ module AtlasRb
|
|
|
506
506
|
# `503`), carrying Atlas's status and body so the failure is attributable
|
|
507
507
|
# at the boundary.
|
|
508
508
|
# @example Offer Restore for a removed caption
|
|
509
|
-
# AtlasRb::Work.
|
|
509
|
+
# AtlasRb::Work.tombstoned_assets("w-789", nuid: admin_nuid).each do |a|
|
|
510
510
|
# AtlasRb::Admin::Resource.restore(a.file_set, nuid: admin_nuid)
|
|
511
511
|
# end
|
|
512
|
-
def self.
|
|
513
|
-
read_body(connection({}, nuid, on_behalf_of: on_behalf_of).get(ROUTE + id + '/
|
|
512
|
+
def self.tombstoned_assets(id, nuid: nil, on_behalf_of: nil)
|
|
513
|
+
read_body(connection({}, nuid, on_behalf_of: on_behalf_of).get(ROUTE + id + '/tombstoned_assets')) do |body|
|
|
514
|
+
body.map { |entry| AtlasRb::Mash.new(entry) }
|
|
515
|
+
end
|
|
516
|
+
end
|
|
517
|
+
|
|
518
|
+
# List the revision dates of a Work's replaced files.
|
|
519
|
+
#
|
|
520
|
+
# Wraps `GET /works/<id>/file_revisions` (Atlas 0.6.243 or later). Each
|
|
521
|
+
# entry names one Blob that has been replaced at least once, as
|
|
522
|
+
# `"blob_id"`, and lists its content revisions newest first under
|
|
523
|
+
# `"revisions"`. A revision carries only `"revision"`, the contiguous
|
|
524
|
+
# 1-based ordinal (1 is the first upload), and `"created"`, an ISO-8601
|
|
525
|
+
# timestamp.
|
|
526
|
+
#
|
|
527
|
+
# The Blobs are the ones {.assets} lists, so a file in a tombstoned FileSet
|
|
528
|
+
# stays out, and a Delegate never appears. Atlas allows the call to anyone
|
|
529
|
+
# who can read the Work, so it carries no attribution, digest, size or
|
|
530
|
+
# filename. The attributed history is {Blob.versions}, which is
|
|
531
|
+
# admin-gated.
|
|
532
|
+
#
|
|
533
|
+
# @param id [String] the Work ID.
|
|
534
|
+
# @param nuid [String, nil] optional acting user's NUID. On the relay-signing
|
|
535
|
+
# path it is signed into the assertion `sub`; on the BYO-JWT (`ATLAS_JWT`)
|
|
536
|
+
# path it is ignored (identity lives in the token).
|
|
537
|
+
# @param on_behalf_of [String, nil] optional NUID for the `On-Behalf-Of`
|
|
538
|
+
# header. Falls through to {AtlasRb.config}.default_on_behalf_of when
|
|
539
|
+
# omitted.
|
|
540
|
+
# @return [Array<AtlasRb::Mash>, nil] one entry per Blob with more than one
|
|
541
|
+
# revision: `"blob_id"` and `"revisions"` (each `"revision"` and
|
|
542
|
+
# `"created"`), newest first. `[]` when no file was ever replaced.
|
|
543
|
+
#
|
|
544
|
+
# `nil` when Atlas answers `404` — no such Work, or, with a misconfigured
|
|
545
|
+
# `ATLAS_URL`, the route is not Atlas's at all.
|
|
546
|
+
# @raise [AtlasRb::ResourceError] on any non-2xx other than `404` / `410`
|
|
547
|
+
# (a `403` for a caller who cannot read the Work, a `5xx`, a proxy's
|
|
548
|
+
# `503`), carrying Atlas's status and body so the failure is attributable
|
|
549
|
+
# at the boundary.
|
|
550
|
+
# @example Show when each file was replaced
|
|
551
|
+
# AtlasRb::Work.file_revisions("w-789", nuid: viewer_nuid).each do |entry|
|
|
552
|
+
# entry.revisions.each { |r| puts "#{entry.blob_id} v#{r.revision} #{r.created}" }
|
|
553
|
+
# end
|
|
554
|
+
def self.file_revisions(id, nuid: nil, on_behalf_of: nil)
|
|
555
|
+
read_body(connection({}, nuid, on_behalf_of: on_behalf_of).get("#{ROUTE}#{id}/file_revisions")) do |body|
|
|
514
556
|
body.map { |entry| AtlasRb::Mash.new(entry) }
|
|
515
557
|
end
|
|
516
558
|
end
|
|
@@ -684,7 +726,7 @@ module AtlasRb
|
|
|
684
726
|
# the terms under `"dwc"`.
|
|
685
727
|
#
|
|
686
728
|
# `nil` when Atlas answers `404` — the Work holds no record (or it was
|
|
687
|
-
#
|
|
729
|
+
# tombstoned), or the id is not a Work.
|
|
688
730
|
# @raise [AtlasRb::ResourceError] on any non-2xx other than `404` / `410`,
|
|
689
731
|
# such as the `403` for a Work the caller may not read.
|
|
690
732
|
# @example
|