packwerk 2.1.1 → 2.2.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (189) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/ci.yml +29 -20
  3. data/.github/workflows/cla.yml +22 -0
  4. data/.rubocop.yml +48 -19
  5. data/Gemfile +7 -2
  6. data/Gemfile.lock +204 -177
  7. data/README.md +7 -2
  8. data/RESOLVING_VIOLATIONS.md +81 -0
  9. data/Rakefile +1 -1
  10. data/USAGE.md +14 -5
  11. data/bin/m +1 -1
  12. data/bin/rake +1 -1
  13. data/bin/rubocop +1 -1
  14. data/bin/srb +1 -1
  15. data/bin/tapioca +1 -1
  16. data/gemfiles/Gemfile-rails-6-0 +1 -1
  17. data/gemfiles/Gemfile-rails-6-1 +22 -0
  18. data/lib/packwerk/application_load_paths.rb +12 -18
  19. data/lib/packwerk/application_validator.rb +7 -6
  20. data/lib/packwerk/association_inspector.rb +17 -15
  21. data/lib/packwerk/cache.rb +36 -29
  22. data/lib/packwerk/cli.rb +14 -8
  23. data/lib/packwerk/const_node_inspector.rb +8 -7
  24. data/lib/packwerk/constant_name_inspector.rb +2 -2
  25. data/lib/packwerk/deprecated_references.rb +34 -19
  26. data/lib/packwerk/file_processor.rb +25 -23
  27. data/lib/packwerk/files_for_processing.rb +33 -35
  28. data/lib/packwerk/formatters/offenses_formatter.rb +3 -3
  29. data/lib/packwerk/formatters/progress_formatter.rb +2 -2
  30. data/lib/packwerk/node.rb +1 -294
  31. data/lib/packwerk/node_helpers.rb +335 -0
  32. data/lib/packwerk/node_processor.rb +6 -5
  33. data/lib/packwerk/node_processor_factory.rb +3 -3
  34. data/lib/packwerk/node_visitor.rb +1 -1
  35. data/lib/packwerk/offense_collection.rb +6 -3
  36. data/lib/packwerk/offenses_formatter.rb +2 -2
  37. data/lib/packwerk/package.rb +3 -0
  38. data/lib/packwerk/package_set.rb +3 -1
  39. data/lib/packwerk/parse_run.rb +15 -13
  40. data/lib/packwerk/parsed_constant_definitions.rb +23 -20
  41. data/lib/packwerk/parsers/erb.rb +3 -3
  42. data/lib/packwerk/parsers/parser_interface.rb +2 -0
  43. data/lib/packwerk/reference_checking/checkers/checker.rb +16 -3
  44. data/lib/packwerk/reference_checking/checkers/dependency_checker.rb +16 -0
  45. data/lib/packwerk/reference_checking/checkers/privacy_checker.rb +18 -0
  46. data/lib/packwerk/reference_checking/reference_checker.rb +4 -4
  47. data/lib/packwerk/reference_extractor.rb +51 -54
  48. data/lib/packwerk/reference_offense.rb +3 -27
  49. data/lib/packwerk/run_context.rb +9 -7
  50. data/lib/packwerk/spring_command.rb +1 -1
  51. data/lib/packwerk/version.rb +1 -1
  52. data/lib/packwerk.rb +1 -0
  53. data/packwerk.gemspec +4 -11
  54. data/sorbet/rbi/gems/actioncable@7.0.3.1.rbi +2754 -0
  55. data/sorbet/rbi/gems/actionmailbox@7.0.3.1.rbi +1496 -0
  56. data/sorbet/rbi/gems/actionmailer@7.0.3.1.rbi +2362 -0
  57. data/sorbet/rbi/gems/actionpack@7.0.3.1.rbi +19397 -0
  58. data/sorbet/rbi/gems/actiontext@7.0.3.1.rbi +1569 -0
  59. data/sorbet/rbi/gems/actionview@7.0.3.1.rbi +14907 -0
  60. data/sorbet/rbi/gems/activejob@7.0.3.1.rbi +2553 -0
  61. data/sorbet/rbi/gems/activemodel@7.0.3.1.rbi +5999 -0
  62. data/sorbet/rbi/gems/activerecord@7.0.3.1.rbi +37832 -0
  63. data/sorbet/rbi/gems/activestorage@7.0.3.1.rbi +2321 -0
  64. data/sorbet/rbi/gems/activesupport@7.0.3.1.rbi +18818 -0
  65. data/sorbet/rbi/gems/concurrent-ruby@1.1.10.rbi +11722 -0
  66. data/sorbet/rbi/gems/constant_resolver@0.2.0.rbi +90 -0
  67. data/sorbet/rbi/gems/diff-lcs@1.5.0.rbi +1079 -0
  68. data/sorbet/rbi/gems/digest@3.1.0.rbi +189 -0
  69. data/sorbet/rbi/gems/erubi@1.11.0.rbi +140 -0
  70. data/sorbet/rbi/gems/globalid@1.0.0.rbi +572 -0
  71. data/sorbet/rbi/gems/i18n@1.12.0.rbi +2296 -0
  72. data/sorbet/rbi/gems/json@2.6.2.rbi +1548 -0
  73. data/sorbet/rbi/gems/language_server-protocol@3.16.0.3.rbi +8 -0
  74. data/sorbet/rbi/gems/loofah@2.18.0.rbi +877 -0
  75. data/sorbet/rbi/gems/m@1.6.0.rbi +257 -0
  76. data/sorbet/rbi/gems/marcel@1.0.2.rbi +220 -0
  77. data/sorbet/rbi/gems/mini_mime@1.1.2.rbi +170 -0
  78. data/sorbet/rbi/gems/mini_portile2@2.8.0.rbi +8 -0
  79. data/sorbet/rbi/gems/minitest-focus@1.3.1.rbi +104 -0
  80. data/sorbet/rbi/gems/minitest@5.16.2.rbi +2136 -0
  81. data/sorbet/rbi/gems/mocha@1.14.0.rbi +4177 -0
  82. data/sorbet/rbi/gems/net-imap@0.2.3.rbi +2147 -0
  83. data/sorbet/rbi/gems/net-pop@0.1.1.rbi +926 -0
  84. data/sorbet/rbi/gems/net-protocol@0.1.3.rbi +11 -0
  85. data/sorbet/rbi/gems/net-smtp@0.3.1.rbi +1108 -0
  86. data/sorbet/rbi/gems/netrc@0.11.0.rbi +153 -0
  87. data/sorbet/rbi/gems/nio4r@2.5.8.rbi +292 -0
  88. data/sorbet/rbi/gems/nokogiri@1.13.8.rbi +6478 -0
  89. data/sorbet/rbi/gems/parallel@1.22.1.rbi +277 -0
  90. data/sorbet/rbi/gems/parser@3.1.2.1.rbi +9029 -0
  91. data/sorbet/rbi/gems/prettier_print@0.1.0.rbi +8 -0
  92. data/sorbet/rbi/gems/pry@0.14.1.rbi +8 -0
  93. data/sorbet/rbi/gems/racc@1.6.0.rbi +152 -0
  94. data/sorbet/rbi/gems/rack-test@2.0.2.rbi +953 -0
  95. data/sorbet/rbi/gems/rack@2.2.4.rbi +5636 -0
  96. data/sorbet/rbi/gems/rails-html-sanitizer@1.4.3.rbi +688 -0
  97. data/sorbet/rbi/gems/rails@7.0.3.1.rbi +8 -0
  98. data/sorbet/rbi/gems/railties@7.0.3.1.rbi +3507 -0
  99. data/sorbet/rbi/gems/rainbow@3.1.1.rbi +392 -0
  100. data/sorbet/rbi/gems/rake@13.0.6.rbi +2924 -0
  101. data/sorbet/rbi/gems/rbi@0.0.15.rbi +3007 -0
  102. data/sorbet/rbi/gems/regexp_parser@2.5.0.rbi +3383 -0
  103. data/sorbet/rbi/gems/rexml@3.2.5.rbi +4714 -0
  104. data/sorbet/rbi/gems/rubocop-ast@1.21.0.rbi +6961 -0
  105. data/sorbet/rbi/gems/rubocop-performance@1.14.3.rbi +2986 -0
  106. data/sorbet/rbi/gems/{rubocop-shopify@2.0.1.rbi → rubocop-shopify@2.9.0.rbi} +4 -4
  107. data/sorbet/rbi/gems/rubocop-sorbet@0.6.11.rbi +992 -0
  108. data/sorbet/rbi/gems/rubocop@1.34.1.rbi +51820 -0
  109. data/sorbet/rbi/gems/ruby-lsp@0.2.1.rbi +11 -0
  110. data/sorbet/rbi/gems/smart_properties@1.17.0.rbi +474 -0
  111. data/sorbet/rbi/gems/spoom@1.1.11.rbi +2181 -0
  112. data/sorbet/rbi/gems/spring@4.0.0.rbi +411 -0
  113. data/sorbet/rbi/gems/strscan@3.0.4.rbi +8 -0
  114. data/sorbet/rbi/gems/syntax_tree@3.3.0.rbi +8 -0
  115. data/sorbet/rbi/gems/tapioca@0.9.2.rbi +3181 -0
  116. data/sorbet/rbi/gems/thor@1.2.1.rbi +3956 -0
  117. data/sorbet/rbi/gems/timeout@0.3.0.rbi +142 -0
  118. data/sorbet/rbi/gems/tzinfo@2.0.5.rbi +5896 -0
  119. data/sorbet/rbi/gems/unicode-display_width@2.2.0.rbi +48 -0
  120. data/sorbet/rbi/gems/unparser@0.6.5.rbi +4529 -0
  121. data/sorbet/rbi/gems/webrick@1.7.0.rbi +2582 -0
  122. data/sorbet/rbi/gems/websocket-driver@0.7.5.rbi +993 -0
  123. data/sorbet/rbi/gems/yard-sorbet@0.6.1.rbi +388 -0
  124. data/sorbet/rbi/gems/yard@0.9.28.rbi +18242 -0
  125. data/sorbet/rbi/gems/zeitwerk@2.6.0.rbi +867 -0
  126. data/sorbet/rbi/shims/psych.rbi +5 -0
  127. data/sorbet/tapioca/require.rb +2 -3
  128. metadata +88 -143
  129. data/.github/probots.yml +0 -2
  130. data/library.yml +0 -6
  131. data/service.yml +0 -1
  132. data/sorbet/rbi/gems/actioncable@7.0.0.alpha-d612542336d9a61381311c95a27d801bb4094779.rbi +0 -860
  133. data/sorbet/rbi/gems/actionmailbox@7.0.0.alpha-d612542336d9a61381311c95a27d801bb4094779.rbi +0 -568
  134. data/sorbet/rbi/gems/actionmailer@7.0.0.alpha-d612542336d9a61381311c95a27d801bb4094779.rbi +0 -587
  135. data/sorbet/rbi/gems/actionpack@7.0.0.alpha-d612542336d9a61381311c95a27d801bb4094779.rbi +0 -5314
  136. data/sorbet/rbi/gems/actiontext@7.0.0.alpha-d612542336d9a61381311c95a27d801bb4094779.rbi +0 -699
  137. data/sorbet/rbi/gems/actionview@7.0.0.alpha-d612542336d9a61381311c95a27d801bb4094779.rbi +0 -2515
  138. data/sorbet/rbi/gems/activejob@7.0.0.alpha-d612542336d9a61381311c95a27d801bb4094779.rbi +0 -624
  139. data/sorbet/rbi/gems/activemodel@7.0.0.alpha-d612542336d9a61381311c95a27d801bb4094779.rbi +0 -1248
  140. data/sorbet/rbi/gems/activerecord@7.0.0.alpha-d612542336d9a61381311c95a27d801bb4094779.rbi +0 -8363
  141. data/sorbet/rbi/gems/activestorage@7.0.0.alpha-d612542336d9a61381311c95a27d801bb4094779.rbi +0 -876
  142. data/sorbet/rbi/gems/activesupport@7.0.0.alpha-d612542336d9a61381311c95a27d801bb4094779.rbi +0 -3987
  143. data/sorbet/rbi/gems/colorize@0.8.1.rbi +0 -40
  144. data/sorbet/rbi/gems/commander@4.5.2.rbi +0 -8
  145. data/sorbet/rbi/gems/concurrent-ruby@1.1.8.rbi +0 -1969
  146. data/sorbet/rbi/gems/constant_resolver@0.1.5.rbi +0 -26
  147. data/sorbet/rbi/gems/erubi@1.10.0.rbi +0 -41
  148. data/sorbet/rbi/gems/globalid@0.4.2.rbi +0 -178
  149. data/sorbet/rbi/gems/highline@2.0.3.rbi +0 -8
  150. data/sorbet/rbi/gems/i18n@1.8.10.rbi +0 -600
  151. data/sorbet/rbi/gems/loofah@2.9.0.rbi +0 -274
  152. data/sorbet/rbi/gems/m@1.5.1.rbi +0 -108
  153. data/sorbet/rbi/gems/marcel@1.0.0.rbi +0 -70
  154. data/sorbet/rbi/gems/mini_mime@1.0.3.rbi +0 -71
  155. data/sorbet/rbi/gems/minitest-focus@1.2.1.rbi +0 -8
  156. data/sorbet/rbi/gems/minitest@5.14.4.rbi +0 -544
  157. data/sorbet/rbi/gems/mocha@1.12.0.rbi +0 -953
  158. data/sorbet/rbi/gems/nio4r@2.5.7.rbi +0 -90
  159. data/sorbet/rbi/gems/nokogiri@1.11.2.rbi +0 -1647
  160. data/sorbet/rbi/gems/parallel@1.20.1.rbi +0 -117
  161. data/sorbet/rbi/gems/parlour@6.0.0.rbi +0 -1272
  162. data/sorbet/rbi/gems/parser@3.0.0.0.rbi +0 -1745
  163. data/sorbet/rbi/gems/pry@0.14.0.rbi +0 -8
  164. data/sorbet/rbi/gems/psych@3.3.2.rbi +0 -24
  165. data/sorbet/rbi/gems/racc@1.5.2.rbi +0 -57
  166. data/sorbet/rbi/gems/rack-test@1.1.0.rbi +0 -335
  167. data/sorbet/rbi/gems/rack@2.2.3.rbi +0 -1718
  168. data/sorbet/rbi/gems/rails-html-sanitizer@1.3.0.rbi +0 -213
  169. data/sorbet/rbi/gems/rails@7.0.0.alpha-d612542336d9a61381311c95a27d801bb4094779.rbi +0 -8
  170. data/sorbet/rbi/gems/railties@7.0.0.alpha-d612542336d9a61381311c95a27d801bb4094779.rbi +0 -880
  171. data/sorbet/rbi/gems/rainbow@3.0.0.rbi +0 -155
  172. data/sorbet/rbi/gems/rake@13.0.3.rbi +0 -837
  173. data/sorbet/rbi/gems/regexp_parser@2.1.1.rbi +0 -8
  174. data/sorbet/rbi/gems/rexml@3.2.4.rbi +0 -8
  175. data/sorbet/rbi/gems/rubocop-ast@1.4.1.rbi +0 -8
  176. data/sorbet/rbi/gems/rubocop-performance@1.10.2.rbi +0 -8
  177. data/sorbet/rbi/gems/rubocop-sorbet@0.6.1.rbi +0 -8
  178. data/sorbet/rbi/gems/rubocop@1.12.0.rbi +0 -8
  179. data/sorbet/rbi/gems/smart_properties@1.15.0.rbi +0 -168
  180. data/sorbet/rbi/gems/spoom@1.1.0.rbi +0 -1061
  181. data/sorbet/rbi/gems/spring@2.1.1.rbi +0 -160
  182. data/sorbet/rbi/gems/sprockets-rails@3.2.2.rbi +0 -451
  183. data/sorbet/rbi/gems/sprockets@4.0.2.rbi +0 -1133
  184. data/sorbet/rbi/gems/tapioca@0.4.19.rbi +0 -603
  185. data/sorbet/rbi/gems/thor@1.1.0.rbi +0 -893
  186. data/sorbet/rbi/gems/tzinfo@2.0.4.rbi +0 -566
  187. data/sorbet/rbi/gems/unicode-display_width@2.0.0.rbi +0 -8
  188. data/sorbet/rbi/gems/websocket-driver@0.7.3.rbi +0 -438
  189. data/sorbet/rbi/gems/zeitwerk@2.4.2.rbi +0 -177
@@ -0,0 +1,572 @@
1
+ # typed: true
2
+
3
+ # DO NOT EDIT MANUALLY
4
+ # This is an autogenerated file for types exported from the `globalid` gem.
5
+ # Please instead update this file by running `bin/tapioca gem globalid`.
6
+
7
+ # source://globalid-1.0.0/lib/global_id/global_id.rb:8
8
+ class GlobalID
9
+ extend ::ActiveSupport::Autoload
10
+
11
+ # @return [GlobalID] a new instance of GlobalID
12
+ #
13
+ # source://globalid-1.0.0/lib/global_id/global_id.rb:51
14
+ def initialize(gid, options = T.unsafe(nil)); end
15
+
16
+ # source://globalid-1.0.0/lib/global_id/global_id.rb:63
17
+ def ==(other); end
18
+
19
+ # source://globalid-1.0.0/lib/global_id/global_id.rb:49
20
+ def app(*_arg0, &_arg1); end
21
+
22
+ # source://globalid-1.0.0/lib/global_id/global_id.rb:63
23
+ def eql?(other); end
24
+
25
+ # source://globalid-1.0.0/lib/global_id/global_id.rb:55
26
+ def find(options = T.unsafe(nil)); end
27
+
28
+ # source://globalid-1.0.0/lib/global_id/global_id.rb:68
29
+ def hash; end
30
+
31
+ # source://globalid-1.0.0/lib/global_id/global_id.rb:59
32
+ def model_class; end
33
+
34
+ # source://globalid-1.0.0/lib/global_id/global_id.rb:49
35
+ def model_id(*_arg0, &_arg1); end
36
+
37
+ # source://globalid-1.0.0/lib/global_id/global_id.rb:49
38
+ def model_name(*_arg0, &_arg1); end
39
+
40
+ # source://globalid-1.0.0/lib/global_id/global_id.rb:49
41
+ def params(*_arg0, &_arg1); end
42
+
43
+ # source://globalid-1.0.0/lib/global_id/global_id.rb:72
44
+ def to_param; end
45
+
46
+ # source://globalid-1.0.0/lib/global_id/global_id.rb:49
47
+ def to_s(*_arg0, &_arg1); end
48
+
49
+ # Returns the value of attribute uri.
50
+ #
51
+ # source://globalid-1.0.0/lib/global_id/global_id.rb:48
52
+ def uri; end
53
+
54
+ class << self
55
+ # Returns the value of attribute app.
56
+ #
57
+ # source://globalid-1.0.0/lib/global_id/global_id.rb:10
58
+ def app; end
59
+
60
+ # source://globalid-1.0.0/lib/global_id/global_id.rb:32
61
+ def app=(app); end
62
+
63
+ # source://globalid-1.0.0/lib/global_id/global_id.rb:12
64
+ def create(model, options = T.unsafe(nil)); end
65
+
66
+ # source://globalid-1.0.0/lib/global_id.rb:15
67
+ def eager_load!; end
68
+
69
+ # source://globalid-1.0.0/lib/global_id/global_id.rb:22
70
+ def find(gid, options = T.unsafe(nil)); end
71
+
72
+ # source://globalid-1.0.0/lib/global_id/global_id.rb:26
73
+ def parse(gid, options = T.unsafe(nil)); end
74
+
75
+ private
76
+
77
+ # source://globalid-1.0.0/lib/global_id/global_id.rb:37
78
+ def parse_encoded_gid(gid, options); end
79
+
80
+ # We removed the base64 padding character = during #to_param, now we're adding it back so decoding will work
81
+ #
82
+ # source://globalid-1.0.0/lib/global_id/global_id.rb:42
83
+ def repad_gid(gid); end
84
+ end
85
+ end
86
+
87
+ # source://globalid-1.0.0/lib/global_id/identification.rb:2
88
+ module GlobalID::Identification
89
+ # source://globalid-1.0.0/lib/global_id/identification.rb:3
90
+ def to_gid(options = T.unsafe(nil)); end
91
+
92
+ # source://globalid-1.0.0/lib/global_id/identification.rb:8
93
+ def to_gid_param(options = T.unsafe(nil)); end
94
+
95
+ # source://globalid-1.0.0/lib/global_id/identification.rb:3
96
+ def to_global_id(options = T.unsafe(nil)); end
97
+
98
+ # source://globalid-1.0.0/lib/global_id/identification.rb:12
99
+ def to_sgid(options = T.unsafe(nil)); end
100
+
101
+ # source://globalid-1.0.0/lib/global_id/identification.rb:17
102
+ def to_sgid_param(options = T.unsafe(nil)); end
103
+
104
+ # source://globalid-1.0.0/lib/global_id/identification.rb:12
105
+ def to_signed_global_id(options = T.unsafe(nil)); end
106
+ end
107
+
108
+ # source://globalid-1.0.0/lib/global_id/locator.rb:5
109
+ module GlobalID::Locator
110
+ class << self
111
+ # Takes either a GlobalID or a string that can be turned into a GlobalID
112
+ #
113
+ # Options:
114
+ # * <tt>:only</tt> - A class, module or Array of classes and/or modules that are
115
+ # allowed to be located. Passing one or more classes limits instances of returned
116
+ # classes to those classes or their subclasses. Passing one or more modules in limits
117
+ # instances of returned classes to those including that module. If no classes or
118
+ # modules match, +nil+ is returned.
119
+ #
120
+ # source://globalid-1.0.0/lib/global_id/locator.rb:15
121
+ def locate(gid, options = T.unsafe(nil)); end
122
+
123
+ # Takes an array of GlobalIDs or strings that can be turned into a GlobalIDs.
124
+ # All GlobalIDs must belong to the same app, as they will be located using
125
+ # the same locator using its locate_many method.
126
+ #
127
+ # By default the GlobalIDs will be located using Model.find(array_of_ids), so the
128
+ # models must respond to that finder signature.
129
+ #
130
+ # This approach will efficiently call only one #find (or #where(id: id), when using ignore_missing)
131
+ # per model class, but still interpolate the results to match the order in which the gids were passed.
132
+ #
133
+ # Options:
134
+ # * <tt>:only</tt> - A class, module or Array of classes and/or modules that are
135
+ # allowed to be located. Passing one or more classes limits instances of returned
136
+ # classes to those classes or their subclasses. Passing one or more modules in limits
137
+ # instances of returned classes to those including that module. If no classes or
138
+ # modules match, +nil+ is returned.
139
+ # * <tt>:ignore_missing</tt> - By default, locate_many will call #find on the model to locate the
140
+ # ids extracted from the GIDs. In Active Record (and other data stores following the same pattern),
141
+ # #find will raise an exception if a named ID can't be found. When you set this option to true,
142
+ # we will use #where(id: ids) instead, which does not raise on missing records.
143
+ #
144
+ # source://globalid-1.0.0/lib/global_id/locator.rb:41
145
+ def locate_many(gids, options = T.unsafe(nil)); end
146
+
147
+ # Takes an array of SignedGlobalIDs or strings that can be turned into a SignedGlobalIDs.
148
+ # The SignedGlobalIDs are located using Model.find(array_of_ids), so the models must respond to
149
+ # that finder signature.
150
+ #
151
+ # This approach will efficiently call only one #find per model class, but still interpolate
152
+ # the results to match the order in which the gids were passed.
153
+ #
154
+ # Options:
155
+ # * <tt>:only</tt> - A class, module or Array of classes and/or modules that are
156
+ # allowed to be located. Passing one or more classes limits instances of returned
157
+ # classes to those classes or their subclasses. Passing one or more modules in limits
158
+ # instances of returned classes to those including that module. If no classes or
159
+ # modules match, +nil+ is returned.
160
+ #
161
+ # source://globalid-1.0.0/lib/global_id/locator.rb:75
162
+ def locate_many_signed(sgids, options = T.unsafe(nil)); end
163
+
164
+ # Takes either a SignedGlobalID or a string that can be turned into a SignedGlobalID
165
+ #
166
+ # Options:
167
+ # * <tt>:only</tt> - A class, module or Array of classes and/or modules that are
168
+ # allowed to be located. Passing one or more classes limits instances of returned
169
+ # classes to those classes or their subclasses. Passing one or more modules in limits
170
+ # instances of returned classes to those including that module. If no classes or
171
+ # modules match, +nil+ is returned.
172
+ #
173
+ # source://globalid-1.0.0/lib/global_id/locator.rb:58
174
+ def locate_signed(sgid, options = T.unsafe(nil)); end
175
+
176
+ # Tie a locator to an app.
177
+ # Useful when different apps collaborate and reference each others' Global IDs.
178
+ #
179
+ # The locator can be either a block or a class.
180
+ #
181
+ # Using a block:
182
+ #
183
+ # GlobalID::Locator.use :foo do |gid|
184
+ # FooRemote.const_get(gid.model_name).find(gid.model_id)
185
+ # end
186
+ #
187
+ # Using a class:
188
+ #
189
+ # GlobalID::Locator.use :bar, BarLocator.new
190
+ #
191
+ # class BarLocator
192
+ # def locate(gid)
193
+ # @search_client.search name: gid.model_name, id: gid.model_id
194
+ # end
195
+ # end
196
+ #
197
+ # @raise [ArgumentError]
198
+ #
199
+ # source://globalid-1.0.0/lib/global_id/locator.rb:99
200
+ def use(app, locator = T.unsafe(nil), &locator_block); end
201
+
202
+ private
203
+
204
+ # @return [Boolean]
205
+ #
206
+ # source://globalid-1.0.0/lib/global_id/locator.rb:112
207
+ def find_allowed?(model_class, only = T.unsafe(nil)); end
208
+
209
+ # source://globalid-1.0.0/lib/global_id/locator.rb:108
210
+ def locator_for(gid); end
211
+
212
+ # source://globalid-1.0.0/lib/global_id/locator.rb:120
213
+ def normalize_app(app); end
214
+
215
+ # source://globalid-1.0.0/lib/global_id/locator.rb:116
216
+ def parse_allowed(gids, only = T.unsafe(nil)); end
217
+ end
218
+ end
219
+
220
+ # source://globalid-1.0.0/lib/global_id/locator.rb:128
221
+ class GlobalID::Locator::BaseLocator
222
+ # source://globalid-1.0.0/lib/global_id/locator.rb:129
223
+ def locate(gid); end
224
+
225
+ # source://globalid-1.0.0/lib/global_id/locator.rb:133
226
+ def locate_many(gids, options = T.unsafe(nil)); end
227
+
228
+ private
229
+
230
+ # source://globalid-1.0.0/lib/global_id/locator.rb:144
231
+ def find_records(model_class, ids, options); end
232
+ end
233
+
234
+ # source://globalid-1.0.0/lib/global_id/locator.rb:173
235
+ class GlobalID::Locator::BlockLocator
236
+ # @return [BlockLocator] a new instance of BlockLocator
237
+ #
238
+ # source://globalid-1.0.0/lib/global_id/locator.rb:174
239
+ def initialize(block); end
240
+
241
+ # source://globalid-1.0.0/lib/global_id/locator.rb:178
242
+ def locate(gid); end
243
+
244
+ # source://globalid-1.0.0/lib/global_id/locator.rb:182
245
+ def locate_many(gids, options = T.unsafe(nil)); end
246
+ end
247
+
248
+ # source://globalid-1.0.0/lib/global_id/locator.rb:171
249
+ GlobalID::Locator::DEFAULT_LOCATOR = T.let(T.unsafe(nil), GlobalID::Locator::UnscopedLocator)
250
+
251
+ # source://globalid-1.0.0/lib/global_id/locator.rb:153
252
+ class GlobalID::Locator::UnscopedLocator < ::GlobalID::Locator::BaseLocator
253
+ # source://globalid-1.0.0/lib/global_id/locator.rb:154
254
+ def locate(gid); end
255
+
256
+ private
257
+
258
+ # source://globalid-1.0.0/lib/global_id/locator.rb:159
259
+ def find_records(model_class, ids, options); end
260
+
261
+ # source://globalid-1.0.0/lib/global_id/locator.rb:163
262
+ def unscoped(model_class); end
263
+ end
264
+
265
+ # source://globalid-1.0.0/lib/global_id/railtie.rb:13
266
+ class GlobalID::Railtie < ::Rails::Railtie; end
267
+
268
+ # source://globalid-1.0.0/lib/global_id/verifier.rb:5
269
+ class GlobalID::Verifier < ::ActiveSupport::MessageVerifier
270
+ private
271
+
272
+ # source://globalid-1.0.0/lib/global_id/verifier.rb:11
273
+ def decode(data); end
274
+
275
+ # source://globalid-1.0.0/lib/global_id/verifier.rb:7
276
+ def encode(data); end
277
+ end
278
+
279
+ # source://globalid-1.0.0/lib/global_id/signed_global_id.rb:5
280
+ class SignedGlobalID < ::GlobalID
281
+ # @return [SignedGlobalID] a new instance of SignedGlobalID
282
+ #
283
+ # source://globalid-1.0.0/lib/global_id/signed_global_id.rb:51
284
+ def initialize(gid, options = T.unsafe(nil)); end
285
+
286
+ # source://globalid-1.0.0/lib/global_id/signed_global_id.rb:69
287
+ def ==(other); end
288
+
289
+ # Returns the value of attribute expires_at.
290
+ #
291
+ # source://globalid-1.0.0/lib/global_id/signed_global_id.rb:49
292
+ def expires_at; end
293
+
294
+ # Returns the value of attribute purpose.
295
+ #
296
+ # source://globalid-1.0.0/lib/global_id/signed_global_id.rb:49
297
+ def purpose; end
298
+
299
+ # source://globalid-1.0.0/lib/global_id/signed_global_id.rb:63
300
+ def to_h; end
301
+
302
+ # source://globalid-1.0.0/lib/global_id/signed_global_id.rb:58
303
+ def to_param; end
304
+
305
+ # source://globalid-1.0.0/lib/global_id/signed_global_id.rb:58
306
+ def to_s; end
307
+
308
+ # Returns the value of attribute verifier.
309
+ #
310
+ # source://globalid-1.0.0/lib/global_id/signed_global_id.rb:49
311
+ def verifier; end
312
+
313
+ private
314
+
315
+ # source://globalid-1.0.0/lib/global_id/signed_global_id.rb:74
316
+ def encoded_expiration; end
317
+
318
+ # source://globalid-1.0.0/lib/global_id/signed_global_id.rb:78
319
+ def pick_expiration(options); end
320
+
321
+ class << self
322
+ # Returns the value of attribute expires_in.
323
+ #
324
+ # source://globalid-1.0.0/lib/global_id/signed_global_id.rb:23
325
+ def expires_in; end
326
+
327
+ # Sets the attribute expires_in
328
+ #
329
+ # @param value the value to set the attribute expires_in to.
330
+ #
331
+ # source://globalid-1.0.0/lib/global_id/signed_global_id.rb:23
332
+ def expires_in=(_arg0); end
333
+
334
+ # source://globalid-1.0.0/lib/global_id/signed_global_id.rb:11
335
+ def parse(sgid, options = T.unsafe(nil)); end
336
+
337
+ # source://globalid-1.0.0/lib/global_id/signed_global_id.rb:27
338
+ def pick_purpose(options); end
339
+
340
+ # Grab the verifier from options and fall back to SignedGlobalID.verifier.
341
+ # Raise ArgumentError if neither is available.
342
+ #
343
+ # source://globalid-1.0.0/lib/global_id/signed_global_id.rb:17
344
+ def pick_verifier(options); end
345
+
346
+ # Returns the value of attribute verifier.
347
+ #
348
+ # source://globalid-1.0.0/lib/global_id/signed_global_id.rb:9
349
+ def verifier; end
350
+
351
+ # Sets the attribute verifier
352
+ #
353
+ # @param value the value to set the attribute verifier to.
354
+ #
355
+ # source://globalid-1.0.0/lib/global_id/signed_global_id.rb:9
356
+ def verifier=(_arg0); end
357
+
358
+ private
359
+
360
+ # source://globalid-1.0.0/lib/global_id/signed_global_id.rb:42
361
+ def raise_if_expired(expires_at); end
362
+
363
+ # source://globalid-1.0.0/lib/global_id/signed_global_id.rb:32
364
+ def verify(sgid, options); end
365
+ end
366
+ end
367
+
368
+ # source://globalid-1.0.0/lib/global_id/signed_global_id.rb:6
369
+ class SignedGlobalID::ExpiredMessage < ::StandardError; end
370
+
371
+ # source://globalid-1.0.0/lib/global_id/uri/gid.rb:6
372
+ module URI
373
+ include ::URI::RFC2396_REGEXP
374
+ extend ::URI::Escape
375
+ end
376
+
377
+ class URI::File < ::URI::Generic
378
+ # source://RUBY_ROOT/uri/file.rb:76
379
+ def check_password(user); end
380
+
381
+ # source://RUBY_ROOT/uri/file.rb:71
382
+ def check_user(user); end
383
+
384
+ # source://RUBY_ROOT/uri/file.rb:66
385
+ def check_userinfo(user); end
386
+
387
+ # source://RUBY_ROOT/uri/file.rb:56
388
+ def set_host(v); end
389
+
390
+ # source://RUBY_ROOT/uri/file.rb:89
391
+ def set_password(v); end
392
+
393
+ # source://RUBY_ROOT/uri/file.rb:62
394
+ def set_port(v); end
395
+
396
+ # source://RUBY_ROOT/uri/file.rb:85
397
+ def set_user(v); end
398
+
399
+ # source://RUBY_ROOT/uri/file.rb:81
400
+ def set_userinfo(v); end
401
+
402
+ class << self
403
+ # source://RUBY_ROOT/uri/file.rb:47
404
+ def build(args); end
405
+ end
406
+ end
407
+
408
+ # source://RUBY_ROOT/uri/file.rb:17
409
+ URI::File::COMPONENT = T.let(T.unsafe(nil), Array)
410
+
411
+ # source://globalid-1.0.0/lib/global_id/uri/gid.rb:27
412
+ class URI::GID < ::URI::Generic
413
+ # URI::GID encodes an app unique reference to a specific model as an URI.
414
+ # It has the components: app name, model class name, model id and params.
415
+ # All components except params are required.
416
+ #
417
+ # The URI format looks like "gid://app/model_name/model_id".
418
+ #
419
+ # Simple metadata can be stored in params. Useful if your app has multiple databases,
420
+ # for instance, and you need to find out which one to look up the model in.
421
+ #
422
+ # Params will be encoded as query parameters like so
423
+ # "gid://app/model_name/model_id?key=value&another_key=another_value".
424
+ #
425
+ # Params won't be typecast, they're always strings.
426
+ # For convenience params can be accessed using both strings and symbol keys.
427
+ #
428
+ # Multi value params aren't supported. Any params encoding multiple values under
429
+ # the same key will return only the last value. For example, when decoding
430
+ # params like "key=first_value&key=last_value" key will only be last_value.
431
+ #
432
+ # Read the documentation for +parse+, +create+ and +build+ for more.
433
+ #
434
+ # source://RUBY_ROOT/uri/generic.rb:244
435
+ def app; end
436
+
437
+ # Returns the value of attribute model_id.
438
+ #
439
+ # source://globalid-1.0.0/lib/global_id/uri/gid.rb:29
440
+ def model_id; end
441
+
442
+ # Returns the value of attribute model_name.
443
+ #
444
+ # source://globalid-1.0.0/lib/global_id/uri/gid.rb:29
445
+ def model_name; end
446
+
447
+ # Returns the value of attribute params.
448
+ #
449
+ # source://globalid-1.0.0/lib/global_id/uri/gid.rb:29
450
+ def params; end
451
+
452
+ # source://globalid-1.0.0/lib/global_id/uri/gid.rb:96
453
+ def to_s; end
454
+
455
+ protected
456
+
457
+ # Ruby 2.2 uses #query= instead of #set_query
458
+ #
459
+ # source://globalid-1.0.0/lib/global_id/uri/gid.rb:108
460
+ def query=(query); end
461
+
462
+ # source://globalid-1.0.0/lib/global_id/uri/gid.rb:119
463
+ def set_params(params); end
464
+
465
+ # source://globalid-1.0.0/lib/global_id/uri/gid.rb:102
466
+ def set_path(path); end
467
+
468
+ # Ruby 2.1 or less uses #set_query to assign the query
469
+ #
470
+ # source://globalid-1.0.0/lib/global_id/uri/gid.rb:114
471
+ def set_query(query); end
472
+
473
+ private
474
+
475
+ # source://globalid-1.0.0/lib/global_id/uri/gid.rb:129
476
+ def check_host(host); end
477
+
478
+ # source://globalid-1.0.0/lib/global_id/uri/gid.rb:134
479
+ def check_path(path); end
480
+
481
+ # source://globalid-1.0.0/lib/global_id/uri/gid.rb:139
482
+ def check_scheme(scheme); end
483
+
484
+ # source://globalid-1.0.0/lib/global_id/uri/gid.rb:171
485
+ def parse_query_params(query); end
486
+
487
+ # source://globalid-1.0.0/lib/global_id/uri/gid.rb:147
488
+ def set_model_components(path, validate = T.unsafe(nil)); end
489
+
490
+ # @raise [URI::InvalidComponentError]
491
+ #
492
+ # source://globalid-1.0.0/lib/global_id/uri/gid.rb:157
493
+ def validate_component(component); end
494
+
495
+ # @raise [MissingModelIdError]
496
+ #
497
+ # source://globalid-1.0.0/lib/global_id/uri/gid.rb:164
498
+ def validate_model_id(model_id, model_name); end
499
+
500
+ class << self
501
+ # Create a new URI::GID from components with argument check.
502
+ #
503
+ # The allowed components are app, model_name, model_id and params, which can be
504
+ # either a hash or an array.
505
+ #
506
+ # Using a hash:
507
+ #
508
+ # URI::GID.build(app: 'bcx', model_name: 'Person', model_id: '1', params: { key: 'value' })
509
+ #
510
+ # Using an array, the arguments must be in order [app, model_name, model_id, params]:
511
+ #
512
+ # URI::GID.build(['bcx', 'Person', '1', key: 'value'])
513
+ #
514
+ # source://globalid-1.0.0/lib/global_id/uri/gid.rb:83
515
+ def build(args); end
516
+
517
+ # Shorthand to build a URI::GID from an app, a model and optional params.
518
+ #
519
+ # URI::GID.create('bcx', Person.find(5), database: 'superhumans')
520
+ #
521
+ # source://globalid-1.0.0/lib/global_id/uri/gid.rb:67
522
+ def create(app, model, params = T.unsafe(nil)); end
523
+
524
+ # Create a new URI::GID by parsing a gid string with argument check.
525
+ #
526
+ # URI::GID.parse 'gid://bcx/Person/1?key=value'
527
+ #
528
+ # This differs from URI() and URI.parse which do not check arguments.
529
+ #
530
+ # URI('gid://bcx') # => URI::GID instance
531
+ # URI.parse('gid://bcx') # => URI::GID instance
532
+ # URI::GID.parse('gid://bcx/') # => raises URI::InvalidComponentError
533
+ #
534
+ # source://globalid-1.0.0/lib/global_id/uri/gid.rb:59
535
+ def parse(uri); end
536
+
537
+ # Validates +app+'s as URI hostnames containing only alphanumeric characters
538
+ # and hyphens. An ArgumentError is raised if +app+ is invalid.
539
+ #
540
+ # URI::GID.validate_app('bcx') # => 'bcx'
541
+ # URI::GID.validate_app('foo-bar') # => 'foo-bar'
542
+ #
543
+ # URI::GID.validate_app(nil) # => ArgumentError
544
+ # URI::GID.validate_app('foo/bar') # => ArgumentError
545
+ #
546
+ # source://globalid-1.0.0/lib/global_id/uri/gid.rb:43
547
+ def validate_app(app); end
548
+ end
549
+ end
550
+
551
+ # source://globalid-1.0.0/lib/global_id/uri/gid.rb:124
552
+ URI::GID::COMPONENT = T.let(T.unsafe(nil), Array)
553
+
554
+ # Raised when creating a Global ID for a model without an id
555
+ #
556
+ # source://globalid-1.0.0/lib/global_id/uri/gid.rb:32
557
+ class URI::GID::MissingModelIdError < ::URI::InvalidComponentError; end
558
+
559
+ # Extracts model_name and model_id from the URI path.
560
+ #
561
+ # source://globalid-1.0.0/lib/global_id/uri/gid.rb:127
562
+ URI::GID::PATH_REGEXP = T.let(T.unsafe(nil), Regexp)
563
+
564
+ # source://RUBY_ROOT/uri/common.rb:18
565
+ URI::Parser = URI::RFC2396_Parser
566
+
567
+ # source://RUBY_ROOT/uri/common.rb:17
568
+ URI::REGEXP = URI::RFC2396_REGEXP
569
+
570
+ class URI::RFC2396_Parser
571
+ include ::URI::RFC2396_REGEXP
572
+ end