graphql_migrate_execution 0.0.1 → 1.0.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.
Files changed (29) hide show
  1. checksums.yaml +4 -4
  2. data/bin/graphql_migrate_execution +38 -0
  3. data/lib/graphql_migrate_execution/action.rb +33 -24
  4. data/lib/graphql_migrate_execution/dataloader_all.rb +30 -14
  5. data/lib/graphql_migrate_execution/dataloader_batch.rb +66 -4
  6. data/lib/graphql_migrate_execution/dataloader_manual.rb +2 -5
  7. data/lib/graphql_migrate_execution/dataloader_shorthand.rb +20 -7
  8. data/lib/graphql_migrate_execution/do_nothing.rb +1 -1
  9. data/lib/graphql_migrate_execution/field_definition.rb +25 -2
  10. data/lib/graphql_migrate_execution/hash_key.rb +12 -0
  11. data/lib/graphql_migrate_execution/implicit.rb +22 -6
  12. data/lib/graphql_migrate_execution/migration.rb +41 -0
  13. data/lib/graphql_migrate_execution/not_implemented.rb +1 -1
  14. data/lib/graphql_migrate_execution/resolve_batch.rb +16 -0
  15. data/lib/graphql_migrate_execution/resolve_each.rb +7 -7
  16. data/lib/graphql_migrate_execution/resolve_static.rb +7 -7
  17. data/lib/graphql_migrate_execution/resolver_method.rb +80 -5
  18. data/lib/graphql_migrate_execution/strategy.rb +63 -15
  19. data/lib/graphql_migrate_execution/type_definition.rb +13 -1
  20. data/lib/graphql_migrate_execution/unsupported_current_path.rb +8 -0
  21. data/lib/graphql_migrate_execution/unsupported_extra.rb +8 -0
  22. data/lib/graphql_migrate_execution/version.rb +1 -1
  23. data/lib/graphql_migrate_execution/visitor.rb +34 -12
  24. data/lib/graphql_migrate_execution.rb +6 -30
  25. data/readme.md +154 -4
  26. metadata +13 -9
  27. data/lib/graphql_migrate_execution/add_future.rb +0 -9
  28. data/lib/graphql_migrate_execution/analyze.rb +0 -30
  29. data/lib/graphql_migrate_execution/remove_legacy.rb +0 -9
@@ -1,9 +0,0 @@
1
- # frozen_string_literal: true
2
- module GraphqlMigrateExecution
3
- class AddFuture < Action
4
- def run
5
- super
6
- call_method_on_strategy(:add_future)
7
- end
8
- end
9
- end
@@ -1,30 +0,0 @@
1
- # frozen_string_literal: true
2
- require "irb"
3
- module GraphqlMigrateExecution
4
- class Analyze < Action
5
- def run
6
- super
7
- message = "Found #{@total_field_definitions} field definitions:".dup
8
-
9
- @field_definitions_by_strategy.each do |strategy_class, definitions|
10
- message << "\n\n#{color("#{color(strategy_class.name.split("::").last, strategy_class.color)} (#{definitions.size})", :BOLD)}:\n"
11
- if !@migration.skip_description
12
- message << "\n#{strategy_class::DESCRIPTION.split("\n").map { |l| l.length > 0 ? " #{l}" : l }.join("\n")}\n"
13
- end
14
- max_path = definitions.map { |f| f.path.size }.max + 2
15
- definitions.each do |field_defn|
16
- name = field_defn.path.ljust(max_path)
17
- message << "\n - #{name} (#{field_defn.resolve_mode.inspect} -> #{field_defn.resolve_mode_key.inspect}) @ #{@path}:#{field_defn.source_line}"
18
- end
19
- end
20
-
21
- message
22
- end
23
-
24
- private
25
-
26
- def color(str, color_or_colors)
27
- IRB::Color.colorize(str, Array(color_or_colors), colorable: @migration.colorable)
28
- end
29
- end
30
- end
@@ -1,9 +0,0 @@
1
- # frozen_string_literal: true
2
- module GraphqlMigrateExecution
3
- class RemoveLegacy < Action
4
- def run
5
- super
6
- call_method_on_strategy(:remove_legacy)
7
- end
8
- end
9
- end