activeitem 0.0.16 → 0.0.17

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: 6460db8a74ca7bcb5d28c0bfdb7c4a6c1eba5c5d68318245612dad78d1d1d282
4
- data.tar.gz: 9fe2d9707efa0a41b74fa1c07c5c24453605baa5d24e3f1880c248c92c5a03b0
3
+ metadata.gz: 3a4b1c7cc7af49e67776f895886bdf472d1e801ab3280f3ea28101bd20b8a701
4
+ data.tar.gz: 7415931df8a26b187e4a9ab52586b67c7cea08f0fa3a476ab09b863c02250835
5
5
  SHA512:
6
- metadata.gz: 61ad96dc3dd1a28bda5a9af288bd17e1eef4f11b450f08efae26c1ea8f8060819727dde8d855d562e0fbbf2e6012096e159952d44c0d22255abc2384d85d80a9
7
- data.tar.gz: 741d0e3a257199f62373c16960bea2d90fe26e37e9f4dcb8516cfb049170caac8a237c90ef1ba17dde88b356218b12f7e5e7d5f4a9d96abee7f64225639762f8
6
+ metadata.gz: b8c97c1ffadb921d440702b5299cf4bb219ba97ad0351cef7bebfea1125e74bf027ddc0546e1a254da8d6da8952598bf170368404c6ab65074ecc8379bfaec3b
7
+ data.tar.gz: b9936169d15857e1423de8f622ddfe85b7be05458739f569ce1983dd6565f234ae2789f12978ac530106cc98203906a99b9666805d1e2e43c7e0a275e7c41d06
@@ -143,9 +143,13 @@ module ActiveItem
143
143
  "#{association_name.to_s.camelize}Index"
144
144
  end
145
145
 
146
+ # Store partition key in DynamoDB format (camelCase) for consistency
147
+ # with RECENT_INDEX and explicit index definitions
148
+ dynamo_key = to_dynamo_key(foreign_key)
149
+
146
150
  @_belongs_to_indexes ||= {}
147
151
  @_belongs_to_indexes = @_belongs_to_indexes.merge(
148
- index_name => { partition_key: foreign_key }
152
+ index_name => { partition_key: dynamo_key }
149
153
  )
150
154
  end
151
155
  end
@@ -547,8 +547,7 @@ module ActiveItem
547
547
  if effective_index && normalized_conditions.any? && normalized_conditions.values.first.is_a?(Array)
548
548
  index_config = resolved_model.indexes[effective_index] || {}
549
549
  ruby_partition_key = normalized_conditions.keys.first.to_s
550
- raw_pk = index_config[:partition_key]&.to_s || ruby_partition_key
551
- dynamo_partition_key = resolved_model.to_dynamo_key(raw_pk)
550
+ dynamo_partition_key = index_config[:partition_key]&.to_s || resolved_model.to_dynamo_key(ruby_partition_key)
552
551
  return fanout_paginated_query(effective_index, normalized_conditions, index_config, dynamo_partition_key,
553
552
  normalized_conditions.values.first, cursor, per_page)
554
553
  end
@@ -613,8 +612,7 @@ module ActiveItem
613
612
  partition_value = normalized_conditions.values.first
614
613
 
615
614
  index_config = resolved_model.indexes[idx_name] || {}
616
- raw_pk = index_config[:partition_key]&.to_s || ruby_partition_key
617
- dynamo_partition_key = resolved_model.to_dynamo_key(raw_pk)
615
+ dynamo_partition_key = index_config[:partition_key]&.to_s || resolved_model.to_dynamo_key(ruby_partition_key)
618
616
 
619
617
  params = {
620
618
  table_name: resolved_model.table_name,
@@ -863,8 +861,7 @@ module ActiveItem
863
861
  partition_value = normalized_conditions.values.first
864
862
 
865
863
  index_config = resolved_model.indexes[idx_name] || {}
866
- raw_partition_key = index_config[:partition_key]&.to_s || ruby_partition_key
867
- dynamo_partition_key = resolved_model.to_dynamo_key(raw_partition_key)
864
+ dynamo_partition_key = index_config[:partition_key]&.to_s || resolved_model.to_dynamo_key(ruby_partition_key)
868
865
 
869
866
  params = {
870
867
  table_name: resolved_model.table_name,
@@ -980,8 +977,7 @@ module ActiveItem
980
977
  partition_value = normalized_conditions.values.first
981
978
 
982
979
  index_config = resolved_model.indexes[idx_name] || {}
983
- raw_pk = index_config[:partition_key]&.to_s || ruby_partition_key
984
- dynamo_partition_key = resolved_model.to_dynamo_key(raw_pk)
980
+ dynamo_partition_key = index_config[:partition_key]&.to_s || resolved_model.to_dynamo_key(ruby_partition_key)
985
981
 
986
982
  params = {
987
983
  table_name: resolved_model.table_name,
@@ -1139,9 +1135,8 @@ module ActiveItem
1139
1135
  # Get the actual DynamoDB partition key name from the index definition
1140
1136
  # The index definition stores the DynamoDB key name (which may be camelCase)
1141
1137
  index_config = resolved_model.indexes[idx_name] || {}
1142
- raw_partition_key = index_config[:partition_key]&.to_s || ruby_partition_key
1143
1138
  # Always convert to DynamoDB key format (camelCase) for the expression
1144
- dynamo_partition_key = resolved_model.to_dynamo_key(raw_partition_key)
1139
+ dynamo_partition_key = index_config[:partition_key]&.to_s || resolved_model.to_dynamo_key(ruby_partition_key)
1145
1140
 
1146
1141
  return fanout_query(idx_name, normalized_conditions, index_config, dynamo_partition_key, partition_value) if partition_value.is_a?(Array)
1147
1142
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ActiveItem
4
- VERSION = '0.0.16'
4
+ VERSION = '0.0.17'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: activeitem
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.16
4
+ version: 0.0.17
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andy Davis