ibrain-core 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/graphql/ibrain/extentions/default_value.rb +2 -0
- data/app/graphql/ibrain/resolvers/base_resolver.rb +3 -3
- data/app/graphql/ibrain/types/filter_type.rb +1 -0
- data/lib/generators/ibrain/graphql/templates/aggregate.erb +4 -1
- data/lib/generators/ibrain/graphql/templates/mutation.erb +6 -1
- data/lib/generators/ibrain/graphql/templates/object.erb +4 -0
- data/lib/generators/ibrain/graphql/templates/resolver.erb +7 -2
- data/lib/generators/ibrain/graphql/templates/resolvers.erb +7 -2
- data/lib/generators/ibrain/install/install_generator.rb +1 -0
- data/lib/generators/ibrain/install/templates/graphql/app_schema.rb.tt +5 -1
- data/lib/generators/ibrain/install/templates/graphql/types/mutation_type.rb.tt +5 -1
- data/lib/generators/ibrain/install/templates/graphql/types/query_type.rb.tt +4 -0
- data/lib/generators/ibrain/install/templates/rubocop.yml.tt +281 -13
- data/lib/ibrain/core/version.rb +2 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 15662385f790ab0c279015f64d2b030b3a8876b3ae065dcba33f882d1c8eb5ef
|
4
|
+
data.tar.gz: b4d0abf1ada4db4e786c708625c554406259a98cb76ad49f23769e2da5c39aee
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bab3e2f29f099217bd5ba3f9d09ab5479208d80e0ced40df6284056d1eb5e5ba3a10c027b3e674ba813c76446e437faa4e8d696b85dc4940a887a42fe6e5c91f
|
7
|
+
data.tar.gz: e23a79aa2347ca540cac61f20923fed42e0288ee98fda296e70734b1cab86740ad4e4a5b4b45524b593cb518ec94b303a8e6a230195a6bbed5a5205111feb6e3
|
@@ -3,9 +3,9 @@
|
|
3
3
|
module Ibrain
|
4
4
|
module Resolvers
|
5
5
|
class BaseResolver < GraphQL::Schema::Resolver
|
6
|
-
argument :filter, Ibrain::Types::FilterType, required: false, default_value: nil
|
7
|
-
argument :
|
8
|
-
argument :
|
6
|
+
argument :filter, Ibrain::Types::FilterType, required: false, default_value: nil, description: 'Filter object for resolver'
|
7
|
+
argument :limit, Int, required: false, default_value: 10, description: 'Limit records'
|
8
|
+
argument :offset, Int, required: false, default_value: 0, description: 'Get records from cursor position'
|
9
9
|
|
10
10
|
def current_user
|
11
11
|
context.fetch(:current_user)
|
@@ -1,6 +1,9 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
<% module_namespacing_when_supported do -%>
|
2
4
|
module Resolvers
|
3
|
-
class <%=
|
5
|
+
class <%= resolver_name %>Aggregate < Ibrain::Resolvers::BaseAggregate
|
6
|
+
description 'Define aggregate to count total records for <%= resolver_name %>'
|
4
7
|
# define resolve method
|
5
8
|
def resolve(args)
|
6
9
|
<%= model_name.capitalize %>.ransack(args[:filter]).result
|
@@ -1,8 +1,13 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
<% module_namespacing_when_supported do -%>
|
2
4
|
module Mutations
|
3
5
|
class <%= mutation_name %> < Ibrain::Mutations::BaseMutation
|
6
|
+
# TODO: define description describe about this mutation
|
7
|
+
# description
|
8
|
+
|
4
9
|
# TODO: define return fields
|
5
|
-
field :<%= model_name.underscore %>, Types::<%= model_name %>Type, null: false
|
10
|
+
field :<%= model_name.underscore %>, Types::<%= model_name %>Type, null: false, description: 'Record Type for mutation response'
|
6
11
|
|
7
12
|
# TODO: define arguments
|
8
13
|
# argument :name, String, required: true
|
@@ -1,8 +1,12 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
<% module_namespacing_when_supported do -%>
|
2
4
|
module Types
|
3
5
|
module Objects
|
4
6
|
class <%= type_ruby_name.split('::')[-1] %> < Ibrain::Types::BaseObject
|
5
7
|
implements Ibrain::Interfaces::RecordInterface
|
8
|
+
|
9
|
+
description '<%= type_ruby_name.split('::')[-1] %>'
|
6
10
|
|
7
11
|
<% normalized_fields.each do |f| %> <%= f.to_ruby %>
|
8
12
|
<% end %>end
|
@@ -1,10 +1,15 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
<% module_namespacing_when_supported do -%>
|
2
4
|
module Resolvers
|
3
5
|
class <%= resolver_name %> < Ibrain::Resolvers::BaseResolver
|
6
|
+
# TODO: define description describe about this mutation
|
7
|
+
# description
|
8
|
+
|
4
9
|
# TODO: define return fields
|
5
|
-
type Types::Objects::<%= model_name.capitalize %>Type, null: false
|
10
|
+
type Types::Objects::<%= model_name.capitalize %>Type, null: false, description: 'Define data type will be response to client'
|
6
11
|
|
7
|
-
argument :id, ID, required: false
|
12
|
+
argument :id, ID, required: false, description: 'TODO: describe about this argument'
|
8
13
|
|
9
14
|
# TODO: define resolve method
|
10
15
|
def resolve(args)
|
@@ -1,8 +1,13 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
<% module_namespacing_when_supported do -%>
|
2
4
|
module Resolvers
|
3
|
-
class <%= resolver_name %> < <%=
|
5
|
+
class <%= resolver_name %> < <%= resolver_name %>Aggregate
|
6
|
+
# TODO: define description describe about this mutation
|
7
|
+
# description
|
8
|
+
|
4
9
|
# TODO: define return fields
|
5
|
-
type [Types::Objects::<%= model_name.capitalize %>Type], null: false
|
10
|
+
type [Types::Objects::<%= model_name.capitalize %>Type], null: false, description: 'Define data type will be response to client'
|
6
11
|
|
7
12
|
# TODO: define resolve method
|
8
13
|
def resolve(args)
|
@@ -79,6 +79,7 @@ module Ibrain
|
|
79
79
|
append_gem('rubocop', '1.23.0', 'development')
|
80
80
|
append_gem('rubocop-performance', '1.12.0', 'development')
|
81
81
|
append_gem('rubocop-rails', '2.12.4', 'development')
|
82
|
+
append_gem('rubocop-graphql', '0.11.2', 'development')
|
82
83
|
end
|
83
84
|
|
84
85
|
if options[:with_graphql]
|
@@ -1,5 +1,9 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Types
|
2
4
|
class MutationType < Ibrain::Types::BaseObject
|
5
|
+
description 'Define all mutation for client'
|
6
|
+
|
3
7
|
# TODO: remove me
|
4
8
|
field :test_field, String, null: false,
|
5
9
|
description: 'An example field added by the generator'
|
@@ -7,4 +11,4 @@ module Types
|
|
7
11
|
'Hello World'
|
8
12
|
end
|
9
13
|
end
|
10
|
-
end
|
14
|
+
end
|
@@ -1,5 +1,9 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Types
|
2
4
|
class QueryType < Ibrain::Types::BaseObject
|
5
|
+
description 'Define all resolver for client'
|
6
|
+
|
3
7
|
# Add `node(id: ID!) and `nodes(ids: [ID!]!)`
|
4
8
|
include GraphQL::Types::Relay::HasNodeField
|
5
9
|
include GraphQL::Types::Relay::HasNodesField
|
@@ -3,15 +3,11 @@
|
|
3
3
|
require:
|
4
4
|
- rubocop-performance
|
5
5
|
- rubocop-rails
|
6
|
+
- rubocop-graphql
|
6
7
|
|
7
8
|
AllCops:
|
8
9
|
TargetRubyVersion: 2.5
|
9
10
|
|
10
|
-
# Sometimes I believe this reads better
|
11
|
-
# This also causes spacing issues on multi-line fixes
|
12
|
-
Style/BracesAroundHashParameters:
|
13
|
-
Enabled: false
|
14
|
-
|
15
11
|
# We use class vars and will have to continue doing so for compatability
|
16
12
|
Style/ClassVars:
|
17
13
|
Enabled: false
|
@@ -78,7 +74,7 @@ Layout/ElseAlignment:
|
|
78
74
|
Layout/IndentationWidth:
|
79
75
|
Enabled: false
|
80
76
|
|
81
|
-
Layout/
|
77
|
+
Layout/ParameterAlignment:
|
82
78
|
Enabled: false
|
83
79
|
|
84
80
|
Layout/ClosingParenthesisIndentation:
|
@@ -87,13 +83,13 @@ Layout/ClosingParenthesisIndentation:
|
|
87
83
|
Layout/MultilineMethodCallIndentation:
|
88
84
|
Enabled: false
|
89
85
|
|
90
|
-
Layout/
|
86
|
+
Layout/FirstArrayElementIndentation:
|
91
87
|
Enabled: false
|
92
88
|
|
93
|
-
Layout/
|
89
|
+
Layout/FirstHashElementIndentation:
|
94
90
|
Enabled: false
|
95
91
|
|
96
|
-
Layout/
|
92
|
+
Layout/HashAlignment:
|
97
93
|
Enabled: false
|
98
94
|
|
99
95
|
Style/TrailingCommaInArguments:
|
@@ -307,7 +303,7 @@ Style/FrozenStringLiteralComment:
|
|
307
303
|
Style/LambdaCall:
|
308
304
|
Enabled: false
|
309
305
|
|
310
|
-
Naming/
|
306
|
+
Naming/MethodParameterName:
|
311
307
|
AllowedNames:
|
312
308
|
- id
|
313
309
|
- to
|
@@ -320,11 +316,283 @@ Style/IdenticalConditionalBranches:
|
|
320
316
|
Naming/MemoizedInstanceVariableName:
|
321
317
|
Enabled: false
|
322
318
|
|
323
|
-
Lint/
|
319
|
+
Lint/BinaryOperatorWithIdenticalOperands:
|
324
320
|
Enabled: false
|
325
321
|
|
326
|
-
Lint/
|
322
|
+
Lint/SuppressedException:
|
327
323
|
Enabled: false
|
328
324
|
|
329
325
|
Rails/ReflectionClassName:
|
330
|
-
Enabled: true
|
326
|
+
Enabled: true
|
327
|
+
Exclude:
|
328
|
+
- app/models/ibrain/role_user.rb
|
329
|
+
|
330
|
+
Gemspec/DateAssignment: # new in 1.10
|
331
|
+
Enabled: true
|
332
|
+
|
333
|
+
Gemspec/RequireMFA: # new in 1.23
|
334
|
+
Enabled: true
|
335
|
+
|
336
|
+
Layout/LineEndStringConcatenationIndentation: # new in 1.18
|
337
|
+
Enabled: true
|
338
|
+
|
339
|
+
Layout/SpaceBeforeBrackets: # new in 1.7
|
340
|
+
Enabled: true
|
341
|
+
|
342
|
+
Lint/AmbiguousAssignment: # new in 1.7
|
343
|
+
Enabled: true
|
344
|
+
|
345
|
+
Lint/AmbiguousOperatorPrecedence: # new in 1.21
|
346
|
+
Enabled: true
|
347
|
+
|
348
|
+
Lint/AmbiguousRange: # new in 1.19
|
349
|
+
Enabled: true
|
350
|
+
|
351
|
+
Lint/DeprecatedConstants: # new in 1.8
|
352
|
+
Enabled: true
|
353
|
+
|
354
|
+
Lint/DuplicateBranch: # new in 1.3
|
355
|
+
Enabled: true
|
356
|
+
|
357
|
+
Lint/DuplicateRegexpCharacterClassElement: # new in 1.1
|
358
|
+
Enabled: true
|
359
|
+
|
360
|
+
Lint/EmptyBlock: # new in 1.1
|
361
|
+
Enabled: true
|
362
|
+
|
363
|
+
Lint/EmptyClass: # new in 1.3
|
364
|
+
Enabled: true
|
365
|
+
|
366
|
+
Lint/EmptyInPattern: # new in 1.16
|
367
|
+
Enabled: true
|
368
|
+
|
369
|
+
Lint/IncompatibleIoSelectWithFiberScheduler: # new in 1.21
|
370
|
+
Enabled: true
|
371
|
+
|
372
|
+
Lint/LambdaWithoutLiteralBlock: # new in 1.8
|
373
|
+
Enabled: true
|
374
|
+
|
375
|
+
Lint/NoReturnInBeginEndBlocks: # new in 1.2
|
376
|
+
Enabled: true
|
377
|
+
|
378
|
+
Lint/NumberedParameterAssignment: # new in 1.9
|
379
|
+
Enabled: true
|
380
|
+
|
381
|
+
Lint/OrAssignmentToConstant: # new in 1.9
|
382
|
+
Enabled: true
|
383
|
+
|
384
|
+
Lint/RedundantDirGlobSort: # new in 1.8
|
385
|
+
Enabled: true
|
386
|
+
|
387
|
+
Lint/RequireRelativeSelfPath: # new in 1.22
|
388
|
+
Enabled: true
|
389
|
+
|
390
|
+
Lint/SymbolConversion: # new in 1.9
|
391
|
+
Enabled: true
|
392
|
+
|
393
|
+
Lint/ToEnumArguments: # new in 1.1
|
394
|
+
Enabled: true
|
395
|
+
|
396
|
+
Lint/TripleQuotes: # new in 1.9
|
397
|
+
Enabled: true
|
398
|
+
|
399
|
+
Lint/UnexpectedBlockArity: # new in 1.5
|
400
|
+
Enabled: true
|
401
|
+
|
402
|
+
Lint/UnmodifiedReduceAccumulator: # new in 1.1
|
403
|
+
Enabled: true
|
404
|
+
|
405
|
+
Lint/UselessRuby2Keywords: # new in 1.23
|
406
|
+
Enabled: true
|
407
|
+
|
408
|
+
Security/IoMethods: # new in 1.22
|
409
|
+
Enabled: true
|
410
|
+
|
411
|
+
Style/ArgumentsForwarding: # new in 1.1
|
412
|
+
Enabled: true
|
413
|
+
|
414
|
+
Style/CollectionCompact: # new in 1.2
|
415
|
+
Enabled: true
|
416
|
+
|
417
|
+
Style/DocumentDynamicEvalDefinition: # new in 1.1
|
418
|
+
Enabled: true
|
419
|
+
|
420
|
+
Style/EndlessMethod: # new in 1.8
|
421
|
+
Enabled: true
|
422
|
+
|
423
|
+
Style/HashConversion: # new in 1.10
|
424
|
+
Enabled: true
|
425
|
+
|
426
|
+
Style/HashExcept: # new in 1.7
|
427
|
+
Enabled: true
|
428
|
+
|
429
|
+
Style/IfWithBooleanLiteralBranches: # new in 1.9
|
430
|
+
Enabled: true
|
431
|
+
|
432
|
+
Style/InPatternThen: # new in 1.16
|
433
|
+
Enabled: true
|
434
|
+
|
435
|
+
Style/MultilineInPatternThen: # new in 1.16
|
436
|
+
Enabled: true
|
437
|
+
|
438
|
+
Style/NegatedIfElseCondition: # new in 1.2
|
439
|
+
Enabled: true
|
440
|
+
|
441
|
+
Style/NilLambda: # new in 1.3
|
442
|
+
Enabled: true
|
443
|
+
|
444
|
+
Style/NumberedParameters: # new in 1.22
|
445
|
+
Enabled: true
|
446
|
+
|
447
|
+
Style/NumberedParametersLimit: # new in 1.22
|
448
|
+
Enabled: true
|
449
|
+
|
450
|
+
Style/OpenStructUse: # new in 1.23
|
451
|
+
Enabled: true
|
452
|
+
|
453
|
+
Style/QuotedSymbols: # new in 1.16
|
454
|
+
Enabled: true
|
455
|
+
|
456
|
+
Style/RedundantArgument: # new in 1.4
|
457
|
+
Enabled: true
|
458
|
+
|
459
|
+
Style/RedundantSelfAssignmentBranch: # new in 1.19
|
460
|
+
Enabled: true
|
461
|
+
|
462
|
+
Style/SelectByRegexp: # new in 1.22
|
463
|
+
Enabled: true
|
464
|
+
|
465
|
+
Style/StringChars: # new in 1.12
|
466
|
+
Enabled: true
|
467
|
+
|
468
|
+
Style/SwapValues: # new in 1.1
|
469
|
+
Enabled: true
|
470
|
+
|
471
|
+
Performance/AncestorsInclude: # new in 1.7
|
472
|
+
Enabled: true
|
473
|
+
|
474
|
+
Performance/BigDecimalWithNumericArgument: # new in 1.7
|
475
|
+
Enabled: true
|
476
|
+
|
477
|
+
Performance/BlockGivenWithExplicitBlock: # new in 1.9
|
478
|
+
Enabled: true
|
479
|
+
|
480
|
+
Performance/CollectionLiteralInLoop: # new in 1.8
|
481
|
+
Enabled: true
|
482
|
+
|
483
|
+
Performance/ConcurrentMonotonicTime: # new in 1.12
|
484
|
+
Enabled: true
|
485
|
+
|
486
|
+
Performance/ConstantRegexp: # new in 1.9
|
487
|
+
Enabled: true
|
488
|
+
|
489
|
+
Performance/MapCompact: # new in 1.11
|
490
|
+
Enabled: true
|
491
|
+
|
492
|
+
Performance/MethodObjectAsBlock: # new in 1.9
|
493
|
+
Enabled: true
|
494
|
+
|
495
|
+
Performance/RedundantEqualityComparisonBlock: # new in 1.10
|
496
|
+
Enabled: true
|
497
|
+
|
498
|
+
Performance/RedundantSortBlock: # new in 1.7
|
499
|
+
Enabled: true
|
500
|
+
|
501
|
+
Performance/RedundantSplitRegexpArgument: # new in 1.10
|
502
|
+
Enabled: true
|
503
|
+
|
504
|
+
Performance/RedundantStringChars: # new in 1.7
|
505
|
+
Enabled: true
|
506
|
+
|
507
|
+
Performance/ReverseFirst: # new in 1.7
|
508
|
+
Enabled: true
|
509
|
+
|
510
|
+
Performance/SortReverse: # new in 1.7
|
511
|
+
Enabled: true
|
512
|
+
|
513
|
+
Performance/Squeeze: # new in 1.7
|
514
|
+
Enabled: true
|
515
|
+
|
516
|
+
Performance/StringInclude: # new in 1.7
|
517
|
+
Enabled: true
|
518
|
+
|
519
|
+
Performance/Sum: # new in 1.8
|
520
|
+
Enabled: true
|
521
|
+
|
522
|
+
Rails/ActiveRecordCallbacksOrder: # new in 2.7
|
523
|
+
Enabled: true
|
524
|
+
|
525
|
+
Rails/AddColumnIndex: # new in 2.11
|
526
|
+
Enabled: true
|
527
|
+
|
528
|
+
Rails/AfterCommitOverride: # new in 2.8
|
529
|
+
Enabled: true
|
530
|
+
|
531
|
+
Rails/AttributeDefaultBlockValue: # new in 2.9
|
532
|
+
Enabled: true
|
533
|
+
|
534
|
+
Rails/EagerEvaluationLogMessage: # new in 2.11
|
535
|
+
Enabled: true
|
536
|
+
|
537
|
+
Rails/ExpandedDateRange: # new in 2.11
|
538
|
+
Enabled: true
|
539
|
+
|
540
|
+
Rails/FindById: # new in 2.7
|
541
|
+
Enabled: true
|
542
|
+
|
543
|
+
Rails/I18nLocaleAssignment: # new in 2.11
|
544
|
+
Enabled: true
|
545
|
+
|
546
|
+
Rails/Inquiry: # new in 2.7
|
547
|
+
Enabled: true
|
548
|
+
|
549
|
+
Rails/MailerName: # new in 2.7
|
550
|
+
Enabled: true
|
551
|
+
|
552
|
+
Rails/MatchRoute: # new in 2.7
|
553
|
+
Enabled: true
|
554
|
+
|
555
|
+
Rails/NegateInclude: # new in 2.7
|
556
|
+
Enabled: true
|
557
|
+
|
558
|
+
Rails/Pluck: # new in 2.7
|
559
|
+
Enabled: true
|
560
|
+
|
561
|
+
Rails/PluckInWhere: # new in 2.7
|
562
|
+
Enabled: true
|
563
|
+
|
564
|
+
Rails/RedundantTravelBack: # new in 2.12
|
565
|
+
Enabled: true
|
566
|
+
|
567
|
+
Rails/RenderInline: # new in 2.7
|
568
|
+
Enabled: true
|
569
|
+
|
570
|
+
Rails/RenderPlainText: # new in 2.7
|
571
|
+
Enabled: true
|
572
|
+
|
573
|
+
Rails/ShortI18n: # new in 2.7
|
574
|
+
Enabled: true
|
575
|
+
|
576
|
+
Rails/SquishedSQLHeredocs: # new in 2.8
|
577
|
+
Enabled: true
|
578
|
+
|
579
|
+
Rails/TimeZoneAssignment: # new in 2.10
|
580
|
+
Enabled: true
|
581
|
+
|
582
|
+
Rails/UnusedIgnoredColumns: # new in 2.11
|
583
|
+
Enabled: true
|
584
|
+
|
585
|
+
Rails/WhereEquals: # new in 2.9
|
586
|
+
Enabled: true
|
587
|
+
|
588
|
+
Rails/WhereExists: # new in 2.7
|
589
|
+
Enabled: true
|
590
|
+
|
591
|
+
Rails/WhereNot: # new in 2.8
|
592
|
+
Enabled: true
|
593
|
+
|
594
|
+
Gemspec/RequiredRubyVersion:
|
595
|
+
Enabled: false
|
596
|
+
|
597
|
+
GraphQL/FieldDescription:
|
598
|
+
Enabled: false
|
data/lib/ibrain/core/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ibrain-core
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tai Nguyen Van
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-12-
|
11
|
+
date: 2021-12-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord-session_store
|