activegraph 11.3.1 → 11.5.0.alpha.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +6 -0
- data/Gemfile +1 -1
- data/activegraph.gemspec +3 -3
- data/lib/active_graph/attribute_set.rb +0 -4
- data/lib/active_graph/base.rb +0 -3
- data/lib/active_graph/config.rb +0 -1
- data/lib/active_graph/core/instrumentable.rb +0 -5
- data/lib/active_graph/core/querable.rb +0 -5
- data/lib/active_graph/core/query.rb +6 -9
- data/lib/active_graph/core/query_clauses.rb +65 -7
- data/lib/active_graph/core/query_ext.rb +1 -1
- data/lib/active_graph/core/record.rb +0 -5
- data/lib/active_graph/core/result.rb +5 -0
- data/lib/active_graph/core/wrappable.rb +1 -1
- data/lib/active_graph/generators/active_model.rb +33 -0
- data/lib/active_graph/generators/generated_attribute.rb +17 -0
- data/lib/{rails/generators/active_graph/migration → active_graph/generators}/migration_generator.rb +0 -4
- data/lib/{rails/generators/active_graph_generator.rb → active_graph/generators/migration_helper.rb} +0 -75
- data/lib/{rails/generators/active_graph/model → active_graph/generators}/model_generator.rb +0 -4
- data/lib/active_graph/generators/source_path_helper.rb +10 -0
- data/lib/{rails/generators/active_graph/upgrade_v8 → active_graph/generators}/upgrade_v8_generator.rb +0 -4
- data/lib/active_graph/lazy_attribute_hash.rb +0 -2
- data/lib/active_graph/migration.rb +0 -3
- data/lib/active_graph/migrations/helpers.rb +0 -7
- data/lib/active_graph/migrations/runner.rb +0 -4
- data/lib/active_graph/migrations.rb +0 -8
- data/lib/active_graph/model_schema.rb +0 -1
- data/lib/active_graph/node/has_n/association.rb +0 -3
- data/lib/active_graph/node/labels.rb +1 -3
- data/lib/active_graph/node/orm_adapter.rb +0 -6
- data/lib/active_graph/node/query/{query_proxy_link.rb → query_proxy/link.rb} +92 -0
- data/lib/active_graph/node/query/query_proxy.rb +20 -3
- data/lib/active_graph/node/scope.rb +4 -43
- data/lib/active_graph/node/wrapping.rb +52 -0
- data/lib/active_graph/node.rb +1 -0
- data/lib/active_graph/railtie.rb +0 -6
- data/lib/active_graph/relationship/property.rb +0 -2
- data/lib/active_graph/relationship/wrapping.rb +26 -0
- data/lib/active_graph/shared/attributes.rb +3 -2
- data/lib/active_graph/shared/node_query_factory.rb +15 -0
- data/lib/active_graph/shared/persistence.rb +1 -1
- data/lib/active_graph/shared/query_factory.rb +0 -60
- data/lib/active_graph/shared/rel_query_factory.rb +47 -0
- data/lib/active_graph/shared/type_converters.rb +0 -6
- data/lib/active_graph/tasks/migration.rake +0 -4
- data/lib/active_graph/timestamps.rb +0 -3
- data/lib/active_graph/version.rb +1 -1
- data/lib/active_graph.rb +43 -114
- metadata +31 -22
- data/lib/active_graph/core.rb +0 -14
- data/lib/active_graph/node/node_wrapper.rb +0 -54
- data/lib/active_graph/relationship/rel_wrapper.rb +0 -31
- data/lib/active_graph/wrapper.rb +0 -4
- /data/lib/active_graph/{errors.rb → error.rb} +0 -0
- /data/lib/{rails/generators/active_graph → active_graph/generators}/migration/templates/migration.erb +0 -0
- /data/lib/{rails/generators/active_graph → active_graph/generators}/model/templates/migration.erb +0 -0
- /data/lib/{rails/generators/active_graph → active_graph/generators}/model/templates/model.erb +0 -0
- /data/lib/{rails/generators/active_graph → active_graph/generators}/upgrade_v8/templates/migration.erb +0 -0
data/lib/active_graph.rb
CHANGED
@@ -1,125 +1,54 @@
|
|
1
|
+
require 'benchmark'
|
2
|
+
require 'bigdecimal'
|
3
|
+
require 'bigdecimal/util'
|
4
|
+
require 'date'
|
1
5
|
require 'forwardable'
|
2
|
-
require 'active_graph/version'
|
3
|
-
|
4
|
-
require 'active_graph/core'
|
5
|
-
require 'active_graph/core/query_ext' # From this gem
|
6
|
-
|
7
|
-
require 'active_support/core_ext/module/attribute_accessors_per_thread'
|
8
|
-
require 'active_graph/secure_random_ext'
|
9
|
-
require 'active_graph/transactions'
|
10
|
-
require 'active_graph/base'
|
11
|
-
require 'active_graph/model_schema'
|
12
|
-
|
13
6
|
require 'active_model'
|
14
|
-
require '
|
15
|
-
require 'active_support/core_ext/
|
16
|
-
require 'active_support/core_ext/class/
|
7
|
+
require 'active_model/attribute_set'
|
8
|
+
require 'active_support/core_ext/big_decimal/conversions'
|
9
|
+
require 'active_support/core_ext/class/attribute'
|
10
|
+
require 'active_support/core_ext/class/subclasses'
|
17
11
|
require 'active_support/core_ext/module/attribute_accessors'
|
12
|
+
require 'active_support/core_ext/module/attribute_accessors_per_thread'
|
13
|
+
require 'active_support/core_ext/string/conversions'
|
14
|
+
require 'active_support/inflector'
|
15
|
+
require 'active_support/inflector/inflections'
|
16
|
+
require 'active_support/notifications'
|
18
17
|
require 'json'
|
18
|
+
require 'neo4j/driver'
|
19
|
+
require 'orm_adapter'
|
20
|
+
require 'rake'
|
21
|
+
require 'set'
|
22
|
+
require 'sorted_set'
|
23
|
+
require 'yaml'
|
19
24
|
|
20
|
-
require 'active_graph/lazy_attribute_hash'
|
21
|
-
require 'active_graph/attribute_set'
|
22
|
-
require 'active_graph/errors'
|
23
|
-
require 'active_graph/config'
|
24
|
-
require 'active_graph/wrapper'
|
25
|
-
require 'active_graph/relationship/rel_wrapper'
|
26
|
-
require 'active_graph/node/node_wrapper'
|
27
|
-
require 'active_graph/shared/type_converters'
|
28
|
-
require 'active_graph/shared/rel_type_converters'
|
29
|
-
require 'active_graph/shared/marshal'
|
30
|
-
require 'active_graph/type_converters'
|
31
|
-
require 'active_graph/paginated'
|
32
|
-
require 'active_graph/schema/operation'
|
33
|
-
|
34
|
-
require 'active_graph/timestamps'
|
35
|
-
require 'active_graph/undeclared_properties'
|
36
|
-
|
37
|
-
require 'active_graph/shared/callbacks'
|
38
|
-
require 'active_graph/shared/filtered_hash'
|
39
|
-
require 'active_graph/shared/declared_property/index'
|
40
|
-
require 'active_graph/shared/declared_property'
|
41
|
-
require 'active_graph/shared/declared_properties'
|
42
|
-
require 'active_graph/shared/enum'
|
43
|
-
require 'active_graph/shared/mass_assignment'
|
44
|
-
require 'active_graph/shared/attributes'
|
45
|
-
require 'active_graph/shared/typecasted_attributes'
|
46
|
-
require 'active_graph/shared/property'
|
47
|
-
require 'active_graph/shared/persistence'
|
48
|
-
require 'active_graph/shared/validations'
|
49
|
-
require 'active_graph/shared/identity'
|
50
|
-
require 'active_graph/shared/serialized_properties'
|
51
|
-
require 'active_graph/shared/typecaster'
|
52
|
-
require 'active_graph/shared/initialize'
|
53
|
-
require 'active_graph/shared/query_factory'
|
54
|
-
require 'active_graph/shared/cypher'
|
55
|
-
require 'active_graph/shared/permitted_attributes'
|
56
|
-
require 'active_graph/shared'
|
57
|
-
|
58
|
-
require 'active_graph/relationship/callbacks'
|
59
|
-
require 'active_graph/relationship/initialize'
|
60
|
-
require 'active_graph/relationship/property'
|
61
|
-
require 'active_graph/relationship/persistence/query_factory'
|
62
|
-
require 'active_graph/relationship/persistence'
|
63
|
-
require 'active_graph/relationship/validations'
|
64
|
-
require 'active_graph/relationship/query'
|
65
|
-
require 'active_graph/relationship/related_node'
|
66
|
-
require 'active_graph/relationship/types'
|
67
|
-
require 'active_graph/relationship'
|
68
|
-
|
69
|
-
require 'active_graph/node/dependent_callbacks'
|
70
|
-
require 'active_graph/node/node_list_formatter'
|
71
|
-
require 'active_graph/node/dependent'
|
72
|
-
require 'active_graph/node/dependent/query_proxy_methods'
|
73
|
-
require 'active_graph/node/dependent/association_methods'
|
74
|
-
require 'active_graph/node/enum'
|
75
|
-
require 'active_graph/node/query_methods'
|
76
|
-
require 'active_graph/node/query/query_proxy_methods'
|
77
|
-
require 'active_graph/node/query/query_proxy_methods_of_mass_updating'
|
78
|
-
require 'active_graph/node/query/query_proxy_enumerable'
|
79
|
-
require 'active_graph/node/query/query_proxy_find_in_batches'
|
80
|
-
require 'active_graph/node/query/query_proxy_eager_loading'
|
81
|
-
require 'active_graph/node/query/query_proxy_eager_loading/association_tree'
|
82
|
-
require 'active_graph/node/query/query_proxy_link'
|
83
|
-
require 'active_graph/node/labels/index'
|
84
|
-
require 'active_graph/node/labels/reloading'
|
85
|
-
require 'active_graph/node/labels'
|
86
|
-
require 'active_graph/node/id_property/accessor'
|
87
|
-
require 'active_graph/node/id_property'
|
88
|
-
require 'active_graph/node/callbacks'
|
89
|
-
require 'active_graph/node/initialize'
|
90
|
-
require 'active_graph/node/property'
|
91
|
-
require 'active_graph/node/persistence'
|
92
|
-
require 'active_graph/node/validations'
|
93
|
-
require 'active_graph/node/rels'
|
94
|
-
require 'active_graph/node/reflection'
|
95
|
-
require 'active_graph/node/unpersisted'
|
96
|
-
require 'active_graph/node/has_n'
|
97
|
-
require 'active_graph/node/has_n/association_cypher_methods'
|
98
|
-
require 'active_graph/node/has_n/association/rel_wrapper'
|
99
|
-
require 'active_graph/node/has_n/association/rel_factory'
|
100
|
-
require 'active_graph/node/has_n/association'
|
101
|
-
require 'active_graph/node/query/query_proxy'
|
102
|
-
require 'active_graph/node/query'
|
103
|
-
require 'active_graph/node/scope'
|
104
|
-
require 'active_graph/node'
|
105
|
-
|
106
|
-
require 'active_support/concern'
|
107
|
-
require 'active_graph/core/cypher_error'
|
108
|
-
require 'active_graph/core/schema_errors'
|
109
|
-
|
110
|
-
module ActiveGraph
|
111
|
-
extend ActiveSupport::Autoload
|
112
|
-
autoload :Migrations
|
113
|
-
autoload :Migration
|
114
|
-
end
|
115
|
-
|
116
|
-
load 'active_graph/tasks/migration.rake'
|
117
|
-
|
118
|
-
require 'active_graph/node/orm_adapter'
|
119
25
|
if defined?(Rails)
|
26
|
+
# Need the action_dispatch railtie to have action_dispatch.rescue_responses initialized correctly
|
27
|
+
require 'action_dispatch/railtie'
|
120
28
|
require 'rails/generators'
|
121
|
-
require 'rails/generators/
|
29
|
+
require 'rails/generators/active_model'
|
30
|
+
require 'rails/generators/named_base'
|
31
|
+
require 'rails/railtie'
|
122
32
|
end
|
123
33
|
|
34
|
+
loader = Zeitwerk::Loader.for_gem
|
35
|
+
unless defined?(Rails)
|
36
|
+
loader.ignore(File.expand_path('active_graph/generators', __dir__))
|
37
|
+
loader.ignore(File.expand_path('active_graph/railtie.rb', __dir__))
|
38
|
+
end
|
39
|
+
loader.inflector.inflect("ansi" => "ANSI")
|
40
|
+
loader.setup
|
41
|
+
# loader.eager_load
|
42
|
+
|
43
|
+
Neo4j::Driver::Result.prepend ActiveGraph::Core::Result
|
44
|
+
Neo4j::Driver::Record.prepend ActiveGraph::Core::Record
|
124
45
|
Neo4j::Driver::Transaction.prepend ActiveGraph::Transaction
|
46
|
+
Neo4j::Driver::Types::Entity.include ActiveGraph::Core::Wrappable
|
47
|
+
Neo4j::Driver::Types::Entity.prepend ActiveGraph::Core::Entity
|
48
|
+
Neo4j::Driver::Types::Node.prepend ActiveGraph::Core::Node
|
49
|
+
Neo4j::Driver::Types::Node.wrapper_callback(&ActiveGraph::Node::Wrapping.method(:wrapper))
|
50
|
+
Neo4j::Driver::Types::Relationship.wrapper_callback(&ActiveGraph::Relationship::Wrapping.method(:wrapper))
|
125
51
|
SecureRandom.singleton_class.prepend ActiveGraph::SecureRandomExt
|
52
|
+
Rails::Generators::GeneratedAttribute.include ActiveGraph::Generators::GeneratedAttribute if defined?(Rails)
|
53
|
+
|
54
|
+
load 'active_graph/tasks/migration.rake'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: activegraph
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 11.
|
4
|
+
version: 11.5.0.alpha.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andreas Ronge, Brian Underwood, Chris Grigg, Heinrich Klobuczek
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-10-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activemodel
|
@@ -59,6 +59,9 @@ dependencies:
|
|
59
59
|
- - ">="
|
60
60
|
- !ruby/object:Gem::Version
|
61
61
|
version: 4.4.1
|
62
|
+
- - "<"
|
63
|
+
- !ruby/object:Gem::Version
|
64
|
+
version: '5'
|
62
65
|
type: :runtime
|
63
66
|
prerelease: false
|
64
67
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -66,18 +69,21 @@ dependencies:
|
|
66
69
|
- - ">="
|
67
70
|
- !ruby/object:Gem::Version
|
68
71
|
version: 4.4.1
|
72
|
+
- - "<"
|
73
|
+
- !ruby/object:Gem::Version
|
74
|
+
version: '5'
|
69
75
|
- !ruby/object:Gem::Dependency
|
70
76
|
name: orm_adapter
|
71
77
|
requirement: !ruby/object:Gem::Requirement
|
72
78
|
requirements:
|
73
|
-
- - "
|
79
|
+
- - ">="
|
74
80
|
- !ruby/object:Gem::Version
|
75
81
|
version: 0.5.0
|
76
82
|
type: :runtime
|
77
83
|
prerelease: false
|
78
84
|
version_requirements: !ruby/object:Gem::Requirement
|
79
85
|
requirements:
|
80
|
-
- - "
|
86
|
+
- - ">="
|
81
87
|
- !ruby/object:Gem::Version
|
82
88
|
version: 0.5.0
|
83
89
|
- !ruby/object:Gem::Dependency
|
@@ -252,14 +258,14 @@ dependencies:
|
|
252
258
|
name: rspec
|
253
259
|
requirement: !ruby/object:Gem::Requirement
|
254
260
|
requirements:
|
255
|
-
- - "
|
261
|
+
- - ">="
|
256
262
|
- !ruby/object:Gem::Version
|
257
263
|
version: '3.10'
|
258
264
|
type: :development
|
259
265
|
prerelease: false
|
260
266
|
version_requirements: !ruby/object:Gem::Requirement
|
261
267
|
requirements:
|
262
|
-
- - "
|
268
|
+
- - ">="
|
263
269
|
- !ruby/object:Gem::Version
|
264
270
|
version: '3.10'
|
265
271
|
description: 'A Neo4j OGM (Object-Graph-Mapper) for Ruby heavily inspired by ActiveRecord.
|
@@ -287,7 +293,6 @@ files:
|
|
287
293
|
- lib/active_graph/base.rb
|
288
294
|
- lib/active_graph/class_arguments.rb
|
289
295
|
- lib/active_graph/config.rb
|
290
|
-
- lib/active_graph/core.rb
|
291
296
|
- lib/active_graph/core/cypher_error.rb
|
292
297
|
- lib/active_graph/core/entity.rb
|
293
298
|
- lib/active_graph/core/instrumentable.rb
|
@@ -305,7 +310,18 @@ files:
|
|
305
310
|
- lib/active_graph/core/schema.rb
|
306
311
|
- lib/active_graph/core/schema_errors.rb
|
307
312
|
- lib/active_graph/core/wrappable.rb
|
308
|
-
- lib/active_graph/
|
313
|
+
- lib/active_graph/error.rb
|
314
|
+
- lib/active_graph/generators/active_model.rb
|
315
|
+
- lib/active_graph/generators/generated_attribute.rb
|
316
|
+
- lib/active_graph/generators/migration/templates/migration.erb
|
317
|
+
- lib/active_graph/generators/migration_generator.rb
|
318
|
+
- lib/active_graph/generators/migration_helper.rb
|
319
|
+
- lib/active_graph/generators/model/templates/migration.erb
|
320
|
+
- lib/active_graph/generators/model/templates/model.erb
|
321
|
+
- lib/active_graph/generators/model_generator.rb
|
322
|
+
- lib/active_graph/generators/source_path_helper.rb
|
323
|
+
- lib/active_graph/generators/upgrade_v8/templates/migration.erb
|
324
|
+
- lib/active_graph/generators/upgrade_v8_generator.rb
|
309
325
|
- lib/active_graph/lazy_attribute_hash.rb
|
310
326
|
- lib/active_graph/migration.rb
|
311
327
|
- lib/active_graph/migrations.rb
|
@@ -339,17 +355,16 @@ files:
|
|
339
355
|
- lib/active_graph/node/labels/index.rb
|
340
356
|
- lib/active_graph/node/labels/reloading.rb
|
341
357
|
- lib/active_graph/node/node_list_formatter.rb
|
342
|
-
- lib/active_graph/node/node_wrapper.rb
|
343
358
|
- lib/active_graph/node/orm_adapter.rb
|
344
359
|
- lib/active_graph/node/persistence.rb
|
345
360
|
- lib/active_graph/node/property.rb
|
346
361
|
- lib/active_graph/node/query.rb
|
347
362
|
- lib/active_graph/node/query/query_proxy.rb
|
363
|
+
- lib/active_graph/node/query/query_proxy/link.rb
|
348
364
|
- lib/active_graph/node/query/query_proxy_eager_loading.rb
|
349
365
|
- lib/active_graph/node/query/query_proxy_eager_loading/association_tree.rb
|
350
366
|
- lib/active_graph/node/query/query_proxy_enumerable.rb
|
351
367
|
- lib/active_graph/node/query/query_proxy_find_in_batches.rb
|
352
|
-
- lib/active_graph/node/query/query_proxy_link.rb
|
353
368
|
- lib/active_graph/node/query/query_proxy_methods.rb
|
354
369
|
- lib/active_graph/node/query/query_proxy_methods_of_mass_updating.rb
|
355
370
|
- lib/active_graph/node/query_methods.rb
|
@@ -358,6 +373,7 @@ files:
|
|
358
373
|
- lib/active_graph/node/scope.rb
|
359
374
|
- lib/active_graph/node/unpersisted.rb
|
360
375
|
- lib/active_graph/node/validations.rb
|
376
|
+
- lib/active_graph/node/wrapping.rb
|
361
377
|
- lib/active_graph/paginated.rb
|
362
378
|
- lib/active_graph/railtie.rb
|
363
379
|
- lib/active_graph/relationship.rb
|
@@ -367,10 +383,10 @@ files:
|
|
367
383
|
- lib/active_graph/relationship/persistence/query_factory.rb
|
368
384
|
- lib/active_graph/relationship/property.rb
|
369
385
|
- lib/active_graph/relationship/query.rb
|
370
|
-
- lib/active_graph/relationship/rel_wrapper.rb
|
371
386
|
- lib/active_graph/relationship/related_node.rb
|
372
387
|
- lib/active_graph/relationship/types.rb
|
373
388
|
- lib/active_graph/relationship/validations.rb
|
389
|
+
- lib/active_graph/relationship/wrapping.rb
|
374
390
|
- lib/active_graph/schema/operation.rb
|
375
391
|
- lib/active_graph/secure_random_ext.rb
|
376
392
|
- lib/active_graph/shared.rb
|
@@ -386,10 +402,12 @@ files:
|
|
386
402
|
- lib/active_graph/shared/initialize.rb
|
387
403
|
- lib/active_graph/shared/marshal.rb
|
388
404
|
- lib/active_graph/shared/mass_assignment.rb
|
405
|
+
- lib/active_graph/shared/node_query_factory.rb
|
389
406
|
- lib/active_graph/shared/permitted_attributes.rb
|
390
407
|
- lib/active_graph/shared/persistence.rb
|
391
408
|
- lib/active_graph/shared/property.rb
|
392
409
|
- lib/active_graph/shared/query_factory.rb
|
410
|
+
- lib/active_graph/shared/rel_query_factory.rb
|
393
411
|
- lib/active_graph/shared/rel_type_converters.rb
|
394
412
|
- lib/active_graph/shared/serialized_properties.rb
|
395
413
|
- lib/active_graph/shared/type_converters.rb
|
@@ -405,15 +423,6 @@ files:
|
|
405
423
|
- lib/active_graph/type_converters.rb
|
406
424
|
- lib/active_graph/undeclared_properties.rb
|
407
425
|
- lib/active_graph/version.rb
|
408
|
-
- lib/active_graph/wrapper.rb
|
409
|
-
- lib/rails/generators/active_graph/migration/migration_generator.rb
|
410
|
-
- lib/rails/generators/active_graph/migration/templates/migration.erb
|
411
|
-
- lib/rails/generators/active_graph/model/model_generator.rb
|
412
|
-
- lib/rails/generators/active_graph/model/templates/migration.erb
|
413
|
-
- lib/rails/generators/active_graph/model/templates/model.erb
|
414
|
-
- lib/rails/generators/active_graph/upgrade_v8/templates/migration.erb
|
415
|
-
- lib/rails/generators/active_graph/upgrade_v8/upgrade_v8_generator.rb
|
416
|
-
- lib/rails/generators/active_graph_generator.rb
|
417
426
|
homepage: https://github.com/neo4jrb/activegraph/
|
418
427
|
licenses:
|
419
428
|
- MIT
|
@@ -440,9 +449,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
440
449
|
version: '2.6'
|
441
450
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
442
451
|
requirements:
|
443
|
-
- - "
|
452
|
+
- - ">"
|
444
453
|
- !ruby/object:Gem::Version
|
445
|
-
version:
|
454
|
+
version: 1.3.1
|
446
455
|
requirements: []
|
447
456
|
rubygems_version: 3.3.26
|
448
457
|
signing_key:
|
data/lib/active_graph/core.rb
DELETED
@@ -1,14 +0,0 @@
|
|
1
|
-
require 'active_graph/core/instrumentable'
|
2
|
-
require 'active_graph/core/entity'
|
3
|
-
require 'active_graph/core/node'
|
4
|
-
require 'active_graph/core/query'
|
5
|
-
require 'active_graph/core/record'
|
6
|
-
require 'active_graph/core/wrappable'
|
7
|
-
require 'active_graph/transaction'
|
8
|
-
require 'neo4j/driver'
|
9
|
-
|
10
|
-
Neo4j::Driver::Types::Entity.include ActiveGraph::Core::Wrappable
|
11
|
-
Neo4j::Driver::Types::Entity.prepend ActiveGraph::Core::Entity
|
12
|
-
Neo4j::Driver::Types::Node.prepend ActiveGraph::Core::Node
|
13
|
-
Neo4j::Driver::Result.prepend ActiveGraph::Core::Result
|
14
|
-
Neo4j::Driver::Record.prepend ActiveGraph::Core::Record
|
@@ -1,54 +0,0 @@
|
|
1
|
-
require 'active_support/inflector'
|
2
|
-
require 'active_graph/core/node'
|
3
|
-
|
4
|
-
wrapping_proc = proc do |node|
|
5
|
-
found_class = ActiveGraph::NodeWrapping.class_to_wrap(node.labels)
|
6
|
-
next node if not found_class
|
7
|
-
|
8
|
-
found_class.new.tap do |wrapped_node|
|
9
|
-
wrapped_node.init_on_load(node, node.properties)
|
10
|
-
end
|
11
|
-
end
|
12
|
-
Neo4j::Driver::Types::Node.wrapper_callback(wrapping_proc)
|
13
|
-
|
14
|
-
module ActiveGraph
|
15
|
-
module NodeWrapping
|
16
|
-
# Only load classes once for performance
|
17
|
-
CONSTANTS_FOR_LABELS_CACHE = {}
|
18
|
-
|
19
|
-
class << self
|
20
|
-
def class_to_wrap(labels)
|
21
|
-
load_classes_from_labels(labels)
|
22
|
-
ActiveGraph::Node::Labels.model_for_labels(labels).tap do |model_class|
|
23
|
-
populate_constants_for_labels_cache(model_class, labels)
|
24
|
-
end
|
25
|
-
end
|
26
|
-
|
27
|
-
private
|
28
|
-
|
29
|
-
def load_classes_from_labels(labels)
|
30
|
-
labels.each { |label| constant_for_label(label) }
|
31
|
-
end
|
32
|
-
|
33
|
-
def constant_for_label(label)
|
34
|
-
CONSTANTS_FOR_LABELS_CACHE[label] || CONSTANTS_FOR_LABELS_CACHE[label] = constantized_label(label)
|
35
|
-
end
|
36
|
-
|
37
|
-
def constantized_label(label)
|
38
|
-
"#{association_model_namespace}::#{label}".constantize
|
39
|
-
rescue NameError, LoadError
|
40
|
-
nil
|
41
|
-
end
|
42
|
-
|
43
|
-
def populate_constants_for_labels_cache(model_class, labels)
|
44
|
-
labels.each do |label|
|
45
|
-
CONSTANTS_FOR_LABELS_CACHE[label] = model_class if CONSTANTS_FOR_LABELS_CACHE[label].nil?
|
46
|
-
end
|
47
|
-
end
|
48
|
-
|
49
|
-
def association_model_namespace
|
50
|
-
ActiveGraph::Config.association_model_namespace_string
|
51
|
-
end
|
52
|
-
end
|
53
|
-
end
|
54
|
-
end
|
@@ -1,31 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
wrapping_proc = proc do |relationship|
|
4
|
-
ActiveGraph::RelWrapping.wrapper(relationship)
|
5
|
-
end
|
6
|
-
Neo4j::Driver::Types::Relationship.wrapper_callback(wrapping_proc)
|
7
|
-
|
8
|
-
module ActiveGraph
|
9
|
-
module RelWrapping
|
10
|
-
class << self
|
11
|
-
def wrapper(rel)
|
12
|
-
rel.properties.symbolize_keys!
|
13
|
-
begin
|
14
|
-
most_concrete_class = class_from_type(rel.type).constantize
|
15
|
-
return rel unless most_concrete_class < ActiveGraph::Relationship
|
16
|
-
most_concrete_class.new
|
17
|
-
rescue NameError => e
|
18
|
-
raise e unless e.message =~ /(uninitialized|wrong) constant/
|
19
|
-
|
20
|
-
return rel
|
21
|
-
end.tap do |wrapped_rel|
|
22
|
-
wrapped_rel.init_on_load(rel, rel.start_node_id, rel.end_node_id, rel.type)
|
23
|
-
end
|
24
|
-
end
|
25
|
-
|
26
|
-
def class_from_type(type)
|
27
|
-
ActiveGraph::Relationship::Types::WRAPPED_CLASSES[type] || ActiveGraph::Relationship::Types::WRAPPED_CLASSES[type] = type.to_s.downcase.camelize
|
28
|
-
end
|
29
|
-
end
|
30
|
-
end
|
31
|
-
end
|
data/lib/active_graph/wrapper.rb
DELETED
File without changes
|
File without changes
|
/data/lib/{rails/generators/active_graph → active_graph/generators}/model/templates/migration.erb
RENAMED
File without changes
|
/data/lib/{rails/generators/active_graph → active_graph/generators}/model/templates/model.erb
RENAMED
File without changes
|
File without changes
|