pakyow-data 1.0.1 → 1.0.2

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: 7764982abc5ed7cee52182df5682fda04521c7258bce5e4685afb63307c9aceb
4
- data.tar.gz: bbdfe1dca59903d72c2b2408e2176fe0b3841e1c21c967f72b0a10b199437d89
3
+ metadata.gz: 1378c2647f72c4d91be73f596565a36c29a4d86bf021d435eed57aecbd9ad9a1
4
+ data.tar.gz: 452bf6c9b17486ff57fc44dc852fd8a138fec7c0449fbb6d7b31ec4725821c93
5
5
  SHA512:
6
- metadata.gz: 81300e9647f7c33e3b6ff1cb26ca49d4f8a501655dc2b6fce6dd1209173e32e0a1a4c8516fa9e23c7f3d922cc4a93fc393fb489dbabce585ae3dc1d1acb3bc6e
7
- data.tar.gz: d9b098db40285afc7df7cd27be5ed0a8e378a85fee906bc1c88ecb81aec4d85c5caa7f7ef954acf2666166048f5634d4fcb29872a31daa298be077ac24c02c4b
6
+ metadata.gz: 36bbc1ec91f8cc806dbb4228be0952110fbd77935b5b37188c7c6d368d58b502e162fecd330245250fe517eed49aa80f0317006d1aaad2d636d88e78011f240c
7
+ data.tar.gz: a8c6dbc07349a57826c3d8900e6a6286ca526a5f64d93ee44bf0af3a948003e91eb02791da98abd04c3972e7092519a639aa61a4da597052bf1c38d731024ef0
data/CHANGELOG.md CHANGED
@@ -1,5 +1,30 @@
1
- # UNRELEASED
1
+ # v1.0.2 (unreleased)
2
2
 
3
- # 1.0
3
+ * `fix` **Data types are now compatible with `dry-types` v1.2.0.**
4
+
5
+ *Related links:*
6
+ - [Pull Request #305][pr-305]
7
+
8
+ * `fix` **Associating sources across connections now works correctly.**
9
+
10
+ *Related links:*
11
+ - [Commit 4c8c544][4c8c544]
12
+
13
+ * `fix` **Setting up associations of different types for the same source now works correctly.**
14
+
15
+ *Related links:*
16
+ - [Commit 12fafe0][12fafe0]
17
+
18
+ * `fix` **Fetching one then all now correctly includes associated data.**
19
+
20
+ *Related links:*
21
+ - [Commit 546e92a][546e92a]
22
+
23
+ [pr-305]: https://github.com/pakyow/pakyow/pull/305
24
+ [4c8c544]: https://github.com/pakyow/pakyow/commit/4c8c544cd7ec91ffe9ec6d4bb72e14699b59357d
25
+ [12fafe0]: https://github.com/pakyow/pakyow/commit/12fafe0ae1e65e15bd9c78b674bb36ef3bee95f3
26
+ [546e92a]: https://github.com/pakyow/pakyow/commit/546e92a02d840f7586439f0abe6a9a56c533d062
27
+
28
+ # v1.0.0
4
29
 
5
30
  * Hello, Web
@@ -31,9 +31,9 @@ module Pakyow
31
31
  time: Data::Types::MAPPING[:time].meta(database_type: Time, column_type: :datetime),
32
32
 
33
33
  # sql-specific types
34
- file: Types.Constructor(Sequel::SQL::Blob).meta(mapping: :file, database_type: File, column_type: :blob),
35
- text: Types::Coercible::String.meta(mapping: :text, database_type: :text, column_type: :text, native_type: "text"),
36
- bignum: Types::Coercible::Integer.meta(mapping: :bignum, database_type: :Bignum)
34
+ file: Data::Types.Constructor(Sequel::SQL::Blob).meta(mapping: :file, database_type: File, column_type: :blob),
35
+ text: Data::Types::Coercible::String.meta(mapping: :text, database_type: :text, column_type: :text, native_type: "text"),
36
+ bignum: Data::Types::Coercible::Integer.meta(mapping: :bignum, database_type: :Bignum)
37
37
  }.freeze
38
38
 
39
39
  require "pakyow/data/adapters/sql/types"
@@ -13,9 +13,9 @@ module Pakyow
13
13
  string: Sql::TYPES[:string].meta(native_type: "text"),
14
14
  text: Sql::TYPES[:text].meta(column_type: :string),
15
15
 
16
- json: Pakyow::Data::Types.Constructor(:json) { |value|
16
+ json: Pakyow::Data::Types.Constructor(::Object) { |value|
17
17
  Sequel.pg_json(value)
18
- }.meta(mapping: :json, database_type: :json)
18
+ }.meta(mapping: :json, database_type: :json, column_type: :json)
19
19
  }.freeze
20
20
  end
21
21
 
@@ -172,11 +172,11 @@ module Pakyow
172
172
  end
173
173
 
174
174
  unless association.internal?
175
- unless associated_source.associations[association.specific_type].any? { |current_association| current_association.joining_source_name == association.joining_source_name }
175
+ unless associated_source.associations[association.specific_type].any? { |current_association| current_association.type == :through && current_association.joining_source_name == association.joining_source_name }
176
176
  associated_source.send(association.specific_type, association.associated_name, source: source.plural_name, as: association.left_name, through: association.joining_source_name, dependent: association.dependent)
177
177
  end
178
178
 
179
- unless source.associations[association.specific_type].any? { |current_association| current_association.associated_source_name == association.joining_source_name }
179
+ unless source.associations[association.specific_type].any? { |current_association| current_association.type == :through && current_association.associated_source_name == association.joining_source_name }
180
180
  source.send(association.specific_type, association.joining_source_name, source: joining_source.plural_name, as: Support.inflector.singularize(association.associated_name), dependent: association.dependent)
181
181
  end
182
182
  end
@@ -132,7 +132,7 @@ module Pakyow
132
132
  )
133
133
 
134
134
  merge_connection_overrides!(connection_opts, connection_overrides)
135
- new(Connection.new(opts: connection_opts, type: adapter, name: connection))
135
+ connect_raw(opts: connection_opts, type: adapter, name: connection)
136
136
  end
137
137
 
138
138
  def connect_global(adapter:, connection:, connection_overrides: {})
@@ -154,12 +154,12 @@ module Pakyow
154
154
 
155
155
  merge_connection_overrides!(connection_opts, connection_overrides)
156
156
  globalize_connection_opts!(adapter, connection_opts)
157
+ connect_raw(opts: connection_opts, type: adapter, name: connection)
158
+ end
157
159
 
158
- connect(
159
- adapter: adapter,
160
- connection: connection,
161
- connection_overrides: connection_opts
162
- )
160
+ # @api private
161
+ def connect_raw(opts:, type:, name:)
162
+ new(Connection.new(opts: opts, type: type, name: name))
163
163
  end
164
164
 
165
165
  private
@@ -289,6 +289,10 @@ module Pakyow
289
289
 
290
290
  def include_results!(results)
291
291
  @included.each do |association, combined_source|
292
+ combined_source = combined_source.source_from_self(
293
+ combined_source.__getobj__.dup
294
+ )
295
+
292
296
  group_by_key, assign_by_key, remove_keys = if association.type == :through
293
297
  joining_source = association.joining_source.instance
294
298
 
@@ -101,7 +101,7 @@ module Pakyow
101
101
 
102
102
  case association_value
103
103
  when Proxy
104
- if association_value.source.class == association.associated_source
104
+ if association_value.source.class.__object_name.name == association.associated_source.__object_name.name
105
105
  if association.result_type == :one && (association_value.count > 1 || (@updates && @source.count > 1))
106
106
  raise ConstraintViolation.new_with_message(
107
107
  :associate_multiple,
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pakyow-data
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bryan Powell
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-07-16 00:00:00.000000000 Z
11
+ date: 2019-11-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: pakyow-core
@@ -16,28 +16,28 @@ dependencies:
16
16
  requirements:
17
17
  - - '='
18
18
  - !ruby/object:Gem::Version
19
- version: 1.0.1
19
+ version: 1.0.2
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - '='
25
25
  - !ruby/object:Gem::Version
26
- version: 1.0.1
26
+ version: 1.0.2
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: pakyow-support
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - '='
32
32
  - !ruby/object:Gem::Version
33
- version: 1.0.1
33
+ version: 1.0.2
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - '='
39
39
  - !ruby/object:Gem::Version
40
- version: 1.0.1
40
+ version: 1.0.2
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: concurrent-ruby
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -72,14 +72,14 @@ dependencies:
72
72
  requirements:
73
73
  - - "~>"
74
74
  - !ruby/object:Gem::Version
75
- version: '1.1'
75
+ version: '1.2'
76
76
  type: :runtime
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
80
  - - "~>"
81
81
  - !ruby/object:Gem::Version
82
- version: '1.1'
82
+ version: '1.2'
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: redis
85
85
  requirement: !ruby/object:Gem::Requirement
@@ -100,14 +100,14 @@ dependencies:
100
100
  requirements:
101
101
  - - "~>"
102
102
  - !ruby/object:Gem::Version
103
- version: '5.22'
103
+ version: '5.26'
104
104
  type: :runtime
105
105
  prerelease: false
106
106
  version_requirements: !ruby/object:Gem::Requirement
107
107
  requirements:
108
108
  - - "~>"
109
109
  - !ruby/object:Gem::Version
110
- version: '5.22'
110
+ version: '5.26'
111
111
  description: Data persistence layer for Pakyow
112
112
  email: bryan@bryanp.org
113
113
  executables: []