cocina-models 0.98.0 → 0.99.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.circleci/config.yml +1 -1
- data/Gemfile.lock +17 -17
- data/README.md +1 -1
- data/description_types.yml +4 -0
- data/docs/description_types.md +4 -0
- data/lib/cocina/models/mapping/from_mods/event.rb +2 -4
- data/lib/cocina/models/validators/reserved_filename_validator.rb +60 -0
- data/lib/cocina/models/validators/validator.rb +2 -1
- data/lib/cocina/models/version.rb +1 -1
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 763a8aa5a80317a106b9c038a61886460e88b6e8e160304f9250b0e5a56bdf1b
|
4
|
+
data.tar.gz: 5c73044a3a7859474e45edce5575445d6fcd2f23f362dafac3b2f417dd8ac5ec
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 584c7fe2ff82aee2afd09ca4873664c8d315410a02fa7f6248bc2e6b59fdf5d8eda869737c2788e910fc294c869e908762afc1467d730f0a938f120f519bc787
|
7
|
+
data.tar.gz: 9efc6b6dfe0141c1de7915e70299ba7ac6586364094dcb5b0c69643486cef911d38725eb89dfa0e38abba10410b15e609449344f19e5c425b1b789faa191e5e3
|
data/.circleci/config.yml
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
cocina-models (0.
|
4
|
+
cocina-models (0.99.0)
|
5
5
|
activesupport
|
6
6
|
deprecation
|
7
7
|
dry-struct (~> 1.0)
|
@@ -46,12 +46,12 @@ GEM
|
|
46
46
|
deprecation (1.1.0)
|
47
47
|
activesupport
|
48
48
|
diff-lcs (1.5.1)
|
49
|
-
docile (1.4.
|
49
|
+
docile (1.4.1)
|
50
50
|
drb (2.2.1)
|
51
51
|
dry-core (1.0.1)
|
52
52
|
concurrent-ruby (~> 1.0)
|
53
53
|
zeitwerk (~> 2.6)
|
54
|
-
dry-inflector (1.
|
54
|
+
dry-inflector (1.1.0)
|
55
55
|
dry-logic (1.5.0)
|
56
56
|
concurrent-ruby (~> 1.0)
|
57
57
|
dry-core (~> 1.0, < 2)
|
@@ -81,10 +81,10 @@ GEM
|
|
81
81
|
multi_json
|
82
82
|
language_server-protocol (3.17.0.3)
|
83
83
|
mini_portile2 (2.8.7)
|
84
|
-
minitest (5.
|
84
|
+
minitest (5.24.1)
|
85
85
|
multi_json (1.15.0)
|
86
86
|
mutex_m (0.2.0)
|
87
|
-
nokogiri (1.16.
|
87
|
+
nokogiri (1.16.7)
|
88
88
|
mini_portile2 (~> 2.8.2)
|
89
89
|
racc (~> 1.4)
|
90
90
|
openapi3_parser (0.10.0)
|
@@ -92,18 +92,18 @@ GEM
|
|
92
92
|
openapi_parser (1.0.0)
|
93
93
|
optimist (3.1.0)
|
94
94
|
parallel (1.25.1)
|
95
|
-
parser (3.3.
|
95
|
+
parser (3.3.4.0)
|
96
96
|
ast (~> 2.4.1)
|
97
97
|
racc
|
98
98
|
patience_diff (1.2.0)
|
99
99
|
optimist (~> 3.0)
|
100
100
|
racc (1.8.0)
|
101
|
-
rack (3.
|
101
|
+
rack (3.1.7)
|
102
102
|
rainbow (3.1.1)
|
103
103
|
rake (13.2.1)
|
104
|
-
rb_sys (0.9.
|
104
|
+
rb_sys (0.9.99)
|
105
105
|
regexp_parser (2.9.2)
|
106
|
-
rexml (3.2
|
106
|
+
rexml (3.3.2)
|
107
107
|
strscan
|
108
108
|
rspec (3.13.0)
|
109
109
|
rspec-core (~> 3.13.0)
|
@@ -111,7 +111,7 @@ GEM
|
|
111
111
|
rspec-mocks (~> 3.13.0)
|
112
112
|
rspec-core (3.13.0)
|
113
113
|
rspec-support (~> 3.13.0)
|
114
|
-
rspec-expectations (3.13.
|
114
|
+
rspec-expectations (3.13.1)
|
115
115
|
diff-lcs (>= 1.2.0, < 2.0)
|
116
116
|
rspec-support (~> 3.13.0)
|
117
117
|
rspec-mocks (3.13.1)
|
@@ -120,13 +120,13 @@ GEM
|
|
120
120
|
rspec-support (3.13.1)
|
121
121
|
rspec_junit_formatter (0.6.0)
|
122
122
|
rspec-core (>= 2, < 4, != 2.12.0)
|
123
|
-
rubocop (1.
|
123
|
+
rubocop (1.65.0)
|
124
124
|
json (~> 2.3)
|
125
125
|
language_server-protocol (>= 3.17.0)
|
126
126
|
parallel (~> 1.10)
|
127
127
|
parser (>= 3.3.0.2)
|
128
128
|
rainbow (>= 2.2.2, < 4.0)
|
129
|
-
regexp_parser (>=
|
129
|
+
regexp_parser (>= 2.4, < 3.0)
|
130
130
|
rexml (>= 3.2.5, < 4.0)
|
131
131
|
rubocop-ast (>= 1.31.1, < 2.0)
|
132
132
|
ruby-progressbar (~> 1.7)
|
@@ -135,8 +135,8 @@ GEM
|
|
135
135
|
parser (>= 3.3.1.0)
|
136
136
|
rubocop-capybara (2.21.0)
|
137
137
|
rubocop (~> 1.41)
|
138
|
-
rubocop-factory_bot (2.26.
|
139
|
-
rubocop (~> 1.
|
138
|
+
rubocop-factory_bot (2.26.1)
|
139
|
+
rubocop (~> 1.61)
|
140
140
|
rubocop-rake (0.6.0)
|
141
141
|
rubocop (~> 1.0)
|
142
142
|
rubocop-rspec (2.31.0)
|
@@ -144,8 +144,8 @@ GEM
|
|
144
144
|
rubocop-capybara (~> 2.17)
|
145
145
|
rubocop-factory_bot (~> 2.22)
|
146
146
|
rubocop-rspec_rails (~> 2.28)
|
147
|
-
rubocop-rspec_rails (2.29.
|
148
|
-
rubocop (~> 1.
|
147
|
+
rubocop-rspec_rails (2.29.1)
|
148
|
+
rubocop (~> 1.61)
|
149
149
|
ruby-progressbar (1.13.0)
|
150
150
|
simplecov (0.22.0)
|
151
151
|
docile (~> 1.1)
|
@@ -162,7 +162,7 @@ GEM
|
|
162
162
|
tzinfo (2.0.6)
|
163
163
|
concurrent-ruby (~> 1.0)
|
164
164
|
unicode-display_width (2.5.0)
|
165
|
-
zeitwerk (2.6.
|
165
|
+
zeitwerk (2.6.16)
|
166
166
|
|
167
167
|
PLATFORMS
|
168
168
|
ruby
|
data/README.md
CHANGED
@@ -140,7 +140,7 @@ Send a note to `#dlss-infra-chg-mgmt` on Slack to let people know what is changi
|
|
140
140
|
|
141
141
|
### Step 1: Cut the release
|
142
142
|
|
143
|
-
The release process is much like any other gem. First bump the version in `lib/cocina/models/version.rb`,
|
143
|
+
The release process is much like any other gem. First bump the version in `lib/cocina/models/version.rb`, then `bundle install` so that `Gemfile.lock` is updated, then commit and push those changes. Then run:
|
144
144
|
```
|
145
145
|
bundle exec rake release
|
146
146
|
```
|
data/description_types.yml
CHANGED
@@ -344,6 +344,8 @@ identifier:
|
|
344
344
|
code: ark
|
345
345
|
- value: arXiv
|
346
346
|
code: arxiv
|
347
|
+
- value: Bates range
|
348
|
+
description: Used in law, medicine, and business for documents as they are scanned or processed, such as for pretrial discovery.
|
347
349
|
- value: case identifier
|
348
350
|
- value: case number
|
349
351
|
- value: CCP
|
@@ -357,6 +359,8 @@ identifier:
|
|
357
359
|
code: doi
|
358
360
|
- value: druid
|
359
361
|
- value: EUR-OP
|
362
|
+
- value: filing number
|
363
|
+
description: Used when placing a paper in the official custody of the clerk of court to enter into the case records.
|
360
364
|
- value: FOLIO
|
361
365
|
description: FOLIO HRID for the source record of the metadata.
|
362
366
|
- value: GTIN-14 ID
|
data/docs/description_types.md
CHANGED
@@ -352,6 +352,8 @@ _Path: identifier.type_
|
|
352
352
|
* Apis ID
|
353
353
|
* ARK
|
354
354
|
* arXiv
|
355
|
+
* Bates range
|
356
|
+
* Used in law, medicine, and business for documents as they are scanned or processed, such as for pretrial discovery.
|
355
357
|
* case identifier
|
356
358
|
* case number
|
357
359
|
* CCP
|
@@ -364,6 +366,8 @@ _Path: identifier.type_
|
|
364
366
|
* DOI
|
365
367
|
* druid
|
366
368
|
* EUR-OP
|
369
|
+
* filing number
|
370
|
+
* Used when placing a paper in the official custody of the clerk of court to enter into the case records.
|
367
371
|
* FOLIO
|
368
372
|
* FOLIO HRID for the source record of the metadata.
|
369
373
|
* GTIN-14 ID
|
@@ -421,7 +421,6 @@ module Cocina
|
|
421
421
|
cocina_desc_val
|
422
422
|
end
|
423
423
|
|
424
|
-
# rubocop:disable Metrics/CyclomaticComplexity
|
425
424
|
def build_structured_date(date_nodes)
|
426
425
|
return if date_nodes.blank?
|
427
426
|
|
@@ -432,13 +431,12 @@ module Cocina
|
|
432
431
|
next if node.text.blank? && node.attributes.empty?
|
433
432
|
|
434
433
|
new_node = node.deep_dup
|
435
|
-
new_node.remove_attribute('encoding') if common_attribs[:encoding].present? || node[:encoding]&.
|
436
|
-
new_node.remove_attribute('qualifier') if common_attribs[:qualifier].present? || node[:qualifier]&.
|
434
|
+
new_node.remove_attribute('encoding') if common_attribs[:encoding].present? || node[:encoding]&.empty?
|
435
|
+
new_node.remove_attribute('qualifier') if common_attribs[:qualifier].present? || node[:qualifier]&.empty?
|
437
436
|
build_date(new_node)
|
438
437
|
end
|
439
438
|
{ structuredValue: dates }.merge(common_attribs).compact
|
440
439
|
end
|
441
|
-
# rubocop:enable Metrics/CyclomaticComplexity
|
442
440
|
|
443
441
|
# Per Arcadia, keyDate should only appear once in an originInfo.
|
444
442
|
# If keyDate is on a date of type point and is on both the start and end points, then
|
@@ -0,0 +1,60 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Cocina
|
4
|
+
module Models
|
5
|
+
module Validators
|
6
|
+
# Validates that bare external identifier not used as a root filename or directory.
|
7
|
+
# This is necessary due to the bare druid being used as part of the Stacks file layout.
|
8
|
+
class ReservedFilenameValidator
|
9
|
+
def self.validate(clazz, attributes)
|
10
|
+
new(clazz, attributes).validate
|
11
|
+
end
|
12
|
+
|
13
|
+
def initialize(clazz, attributes)
|
14
|
+
@clazz = clazz
|
15
|
+
@attributes = attributes
|
16
|
+
end
|
17
|
+
|
18
|
+
def validate
|
19
|
+
return unless dro?
|
20
|
+
|
21
|
+
return if filenames.none? { |filename| reserved?(filename) }
|
22
|
+
|
23
|
+
raise ValidationError, 'Bare druid may not be used as a filename or a base directory'
|
24
|
+
end
|
25
|
+
|
26
|
+
private
|
27
|
+
|
28
|
+
attr_reader :clazz, :attributes
|
29
|
+
|
30
|
+
def dro?
|
31
|
+
(clazz::TYPES & DRO::TYPES).any? && attributes[:externalIdentifier].present?
|
32
|
+
rescue NameError
|
33
|
+
false
|
34
|
+
end
|
35
|
+
|
36
|
+
def reserved?(filename)
|
37
|
+
filename == bare_external_identifier || filename.start_with?("#{bare_external_identifier}/")
|
38
|
+
end
|
39
|
+
|
40
|
+
def bare_external_identifier
|
41
|
+
@bare_external_identifier ||= attributes[:externalIdentifier].delete_prefix('druid:')
|
42
|
+
end
|
43
|
+
|
44
|
+
def filenames
|
45
|
+
[].tap do |filenames|
|
46
|
+
next if attributes.dig(:structural, :contains).nil?
|
47
|
+
|
48
|
+
attributes[:structural][:contains].each do |fileset|
|
49
|
+
next if fileset.dig(:structural, :contains).nil?
|
50
|
+
|
51
|
+
fileset[:structural][:contains].each do |file|
|
52
|
+
filenames << file[:filename] if file[:filename].present?
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cocina-models
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.99.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Justin Coyne
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-08-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -521,6 +521,7 @@ files:
|
|
521
521
|
- lib/cocina/models/validators/language_tag_validator.rb
|
522
522
|
- lib/cocina/models/validators/open_api_validator.rb
|
523
523
|
- lib/cocina/models/validators/purl_validator.rb
|
524
|
+
- lib/cocina/models/validators/reserved_filename_validator.rb
|
524
525
|
- lib/cocina/models/validators/validator.rb
|
525
526
|
- lib/cocina/models/validators/w3cdtf_validator.rb
|
526
527
|
- lib/cocina/models/version.rb
|
@@ -549,7 +550,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
549
550
|
- !ruby/object:Gem::Version
|
550
551
|
version: '0'
|
551
552
|
requirements: []
|
552
|
-
rubygems_version: 3.
|
553
|
+
rubygems_version: 3.4.19
|
553
554
|
signing_key:
|
554
555
|
specification_version: 4
|
555
556
|
summary: Data models for the SDR
|