bulkrax 9.2.1 → 9.3.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 462afc87884a3c6ed23d3d8b9237ec3dafeffcd2cda9b8e0836d74e0bcd68657
4
- data.tar.gz: 4373f2ab775eb346a9b34b2bf7c2238b2b3c192a2c5d9a7e039974a56527ca74
3
+ metadata.gz: 6b2230355bb1411a1ef0d5a17c70a957f87c88c0b1a5254fda5646eb89a07bc1
4
+ data.tar.gz: b8211fe255a2a094854b9a0174b3b2154de093c53f838befdc2c8f8246d7731b
5
5
  SHA512:
6
- metadata.gz: 887b076e34be355fe1708d97d1ab022106aa0c7e9eb8acf80233a3db0c648fb4642ab5be3cf8ddaf9fc270ebf61d0762630d803893de6d417a3baf6332405d86
7
- data.tar.gz: bd12861189a4182da26dd3337dd4d89536616ec632a211ba4d8821c3d390d4b03093ed49a77a184359b95c7ae1667bcd4efc59a2fd907af370cadb861eb8f895
6
+ metadata.gz: 555612ee946fcf1b48a353f93e20fafbe3c04052f28c99e129f3af7a216022416d4fcc3a51dca25943d5c10b2a86355871e1a788b5ab3046093cdf808efa7644
7
+ data.tar.gz: 3fae6e18a3bd810446dc7fb0dc2486e283ad74f28bad18c75426cc5589386b1fa32e05210eb1367fead50acf0649b7de64dd52a9c208b2450002fb10ece33e0d
@@ -335,9 +335,19 @@ module Bulkrax
335
335
  nil
336
336
  end
337
337
 
338
+ # @note We perform the transaction against the *parent* here, because the FileSets are generated and updated in relationship with their parent, not in isolation
338
339
  def create_file_set(attrs)
339
- # TODO: Make it work for Valkyrie
340
- raise NotImplementedError, __method__.to_s
340
+ attrs = HashWithIndifferentAccess.new(attrs)
341
+ parent_object = find_record(attributes[related_parents_parsed_mapping].first, importer_run_id).last
342
+ perform_transaction_for(object: parent_object, attrs: {}) do
343
+ fs_attrs = attrs.merge(attributes).symbolize_keys
344
+ uploaded_files, = prep_fileset_content(attrs)
345
+ transactions['change_set.update_work']
346
+ .with_step_args(
347
+ 'work_resource.add_file_sets' => { uploaded_files: uploaded_files, file_set_params: [fs_attrs] },
348
+ 'work_resource.save_acl' => { permissions_params: [attrs.try('visibility') || 'open'].compact }
349
+ )
350
+ end
341
351
  end
342
352
 
343
353
  def create_work(attrs)
@@ -136,6 +136,7 @@ module Bulkrax
136
136
  # When the parent is a collection, we save the relationship on each child.
137
137
  # The parent does not need to be saved, as the relationship is stored on the child.
138
138
  # but we do reindex the parent after all the children are added.
139
+ # rubocop:disable Layout/RescueEnsureAlignment
139
140
  def process_parent_as_collection(parent_record:, parent_identifier:)
140
141
  ActiveRecord::Base.uncached do
141
142
  Bulkrax::PendingRelationship.where(parent_id: parent_identifier, importer_run_id: @importer_run_id)
@@ -151,7 +152,6 @@ module Bulkrax
151
152
  @errors << e
152
153
  end
153
154
  end
154
-
155
155
  # if collection members were added, we reindex the collection
156
156
  # The collection members have already saved the relationships
157
157
  # To index the parent, we want to make sure we have the latest version of the parent,
@@ -161,6 +161,7 @@ module Bulkrax
161
161
  Bulkrax.object_factory.update_index(resources: [reloaded_parent])
162
162
  Bulkrax.object_factory.publish(event: 'object.membership.updated', object: reloaded_parent, user: @user)
163
163
  end
164
+ # rubocop:enable Layout/RescueEnsureAlignment
164
165
 
165
166
  # When the parent is a work, we save the relationship on the parent.
166
167
  # We prefer to save all of the member relationships and then save the parent once. Concurrent
@@ -168,6 +169,7 @@ module Bulkrax
168
169
  # record while we are adding the children to it.
169
170
  # However the locking appears to not be working so as a workaround we will save each member as we go,
170
171
  # but only index the parent once at the end.
172
+ # rubocop:disable Layout/RescueEnsureAlignment
171
173
  def process_parent_as_work(parent_record:, parent_identifier:)
172
174
  conditionally_acquire_lock_for(parent_record.id.to_s) do
173
175
  ActiveRecord::Base.uncached do
@@ -193,6 +195,7 @@ module Bulkrax
193
195
  end
194
196
  end
195
197
  end
198
+ # rubocop:enable Layout/RescueEnsureAlignment
196
199
 
197
200
  # NOTE: the child changes are saved in the object factory.
198
201
  def add_to_collection(relationship:, parent_record:, ability:)
@@ -22,7 +22,12 @@ module Bulkrax
22
22
  super(message)
23
23
  end
24
24
  end
25
- serialize :raw_metadata, Bulkrax::NormalizedJson
25
+
26
+ if Rails.version < '7.1'
27
+ serialize :raw_metadata, Bulkrax::NormalizedJson
28
+ else
29
+ serialize :raw_metadata, coder: Bulkrax::NormalizedJson
30
+ end
26
31
 
27
32
  def self.fields_from_data(data)
28
33
  data.headers.flatten.compact.uniq
@@ -18,9 +18,15 @@ module Bulkrax
18
18
  alias importer importerexporter
19
19
  alias exporter importerexporter
20
20
 
21
- serialize :parsed_metadata, Bulkrax::NormalizedJson
22
- # Do not serialize raw_metadata as so we can support xml or other formats
23
- serialize :collection_ids, Array
21
+ if Rails.version < '7.1'
22
+ serialize :parsed_metadata, Bulkrax::NormalizedJson
23
+ # Do not serialize raw_metadata as so we can support xml or other formats
24
+ serialize :collection_ids, Array
25
+ else
26
+ serialize :parsed_metadata, coder: Bulkrax::NormalizedJson
27
+ # Do not serialize raw_metadata as so we can support xml or other formats
28
+ serialize :collection_ids, coder: YAML, type: Array
29
+ end
24
30
 
25
31
  paginates_per 5
26
32
 
@@ -4,8 +4,13 @@ module Bulkrax
4
4
  include Bulkrax::ImporterExporterBehavior
5
5
  include Bulkrax::StatusInfo
6
6
 
7
- serialize :parser_fields, JSON
8
- serialize :field_mapping, JSON
7
+ if Rails.version < '7.1'
8
+ serialize :parser_fields, JSON
9
+ serialize :field_mapping, JSON
10
+ else
11
+ serialize :parser_fields, coder: JSON
12
+ serialize :field_mapping, coder: JSON
13
+ end
9
14
 
10
15
  belongs_to :user
11
16
  has_many :exporter_runs, dependent: :destroy
@@ -5,8 +5,13 @@ module Bulkrax
5
5
  include Bulkrax::ImporterExporterBehavior
6
6
  include Bulkrax::StatusInfo
7
7
 
8
- serialize :parser_fields, JSON
9
- serialize :field_mapping, JSON
8
+ if Rails.version < '7.1'
9
+ serialize :parser_fields, JSON
10
+ serialize :field_mapping, JSON
11
+ else
12
+ serialize :parser_fields, coder: JSON
13
+ serialize :field_mapping, coder: JSON
14
+ end
10
15
 
11
16
  belongs_to :user
12
17
  has_many :importer_runs, dependent: :destroy
@@ -2,7 +2,11 @@
2
2
 
3
3
  module Bulkrax
4
4
  class OaiEntry < Entry
5
- serialize :raw_metadata, Bulkrax::NormalizedJson
5
+ if Rails.version < '7.1'
6
+ serialize :raw_metadata, Bulkrax::NormalizedJson
7
+ else
8
+ serialize :raw_metadata, coder: Bulkrax::NormalizedJson
9
+ end
6
10
 
7
11
  delegate :record, to: :raw_record
8
12
 
@@ -3,7 +3,11 @@
3
3
  unless ENV.fetch('BULKRAX_NO_RDF', 'false').to_s == 'true'
4
4
  module Bulkrax
5
5
  class RdfEntry < Entry
6
- serialize :raw_metadata, Bulkrax::NormalizedJson
6
+ if Rails.version < '7.1'
7
+ serialize :raw_metadata, Bulkrax::NormalizedJson
8
+ else
9
+ serialize :raw_metadata, coder: Bulkrax::NormalizedJson
10
+ end
7
11
 
8
12
  def self.read_data(path)
9
13
  RDF::Reader.open(path)
@@ -4,7 +4,12 @@ module Bulkrax
4
4
  class Status < ApplicationRecord
5
5
  belongs_to :statusable, polymorphic: true, denormalize: { fields: %i[status_message error_class], if: :latest? }
6
6
  belongs_to :runnable, polymorphic: true
7
- serialize :error_backtrace, Array
7
+
8
+ if Rails.version < '7.1'
9
+ serialize :error_backtrace, Array
10
+ else
11
+ serialize :error_backtrace, coder: YAML, type: Array
12
+ end
8
13
 
9
14
  scope :for_importers, -> { where(statusable_type: 'Bulkrax::Importer') }
10
15
  scope :for_exporters, -> { where(statusable_type: 'Bulkrax::Exporter') }
@@ -3,7 +3,11 @@
3
3
  module Bulkrax
4
4
  # Generic XML Entry
5
5
  class XmlEntry < Entry
6
- serialize :raw_metadata, Bulkrax::NormalizedJson
6
+ if Rails.version < '7.1'
7
+ serialize :raw_metadata, Bulkrax::NormalizedJson
8
+ else
9
+ serialize :raw_metadata, coder: Bulkrax::NormalizedJson
10
+ end
7
11
 
8
12
  def self.fields_from_data(data); end
9
13
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Bulkrax
4
- VERSION = '9.2.1'
4
+ VERSION = '9.3.0'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bulkrax
3
3
  version: !ruby/object:Gem::Version
4
- version: 9.2.1
4
+ version: 9.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rob Kaufman
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2025-09-17 00:00:00.000000000 Z
11
+ date: 2025-09-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -19,7 +19,7 @@ dependencies:
19
19
  version: 5.1.6
20
20
  - - "<"
21
21
  - !ruby/object:Gem::Version
22
- version: 7.0.0
22
+ version: 8.0.0
23
23
  type: :runtime
24
24
  prerelease: false
25
25
  version_requirements: !ruby/object:Gem::Requirement
@@ -29,7 +29,7 @@ dependencies:
29
29
  version: 5.1.6
30
30
  - - "<"
31
31
  - !ruby/object:Gem::Version
32
- version: 7.0.0
32
+ version: 8.0.0
33
33
  - !ruby/object:Gem::Dependency
34
34
  name: bagit
35
35
  requirement: !ruby/object:Gem::Requirement
@@ -527,7 +527,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
527
527
  - !ruby/object:Gem::Version
528
528
  version: '0'
529
529
  requirements: []
530
- rubygems_version: 3.2.3
530
+ rubygems_version: 3.4.10
531
531
  signing_key:
532
532
  specification_version: 4
533
533
  summary: Import and export tool for Hyrax and Hyku