eco-helpers 3.0.21 → 3.0.23

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 (154) hide show
  1. checksums.yaml +4 -4
  2. data/.idea/.gitignore +10 -0
  3. data/CHANGELOG.md +44 -2
  4. data/eco-helpers.gemspec +5 -3
  5. data/lib/eco/api/common/class_helpers.rb +2 -1
  6. data/lib/eco/api/common/class_hierarchy.rb +6 -9
  7. data/lib/eco/api/common/loaders/case_base.rb +12 -4
  8. data/lib/eco/api/common/loaders/config/workflow/cases_extension.rb +53 -0
  9. data/lib/eco/api/common/loaders/config/workflow/mailer.rb +2 -14
  10. data/lib/eco/api/common/loaders/config/workflow.rb +4 -0
  11. data/lib/eco/api/common/loaders/error_handler.rb +3 -2
  12. data/lib/eco/api/common/loaders/policy.rb +3 -2
  13. data/lib/eco/api/common/loaders/use_case/cli_identify.rb +28 -0
  14. data/lib/eco/api/common/loaders/use_case/target_model.rb +25 -0
  15. data/lib/eco/api/common/loaders/use_case/type.rb +37 -0
  16. data/lib/eco/api/common/loaders/use_case.rb +16 -43
  17. data/lib/eco/api/error/handler.rb +6 -4
  18. data/lib/eco/api/error/handlers.rb +12 -5
  19. data/lib/eco/api/microcases/people/apply_changes/set_account/account_excluded.rb +34 -0
  20. data/lib/eco/api/microcases/people/apply_changes/set_account.rb +28 -0
  21. data/lib/eco/api/microcases/people/apply_changes/set_core/core_excluded.rb +28 -0
  22. data/lib/eco/api/microcases/people/apply_changes/set_core.rb +27 -0
  23. data/lib/eco/api/microcases/people/apply_changes/set_core_with_supervisor.rb +38 -0
  24. data/lib/eco/api/microcases/people/apply_changes/set_supervisor.rb +69 -0
  25. data/lib/eco/api/microcases/people/apply_changes.rb +19 -0
  26. data/lib/eco/api/microcases/people/fetch/with_each.rb +109 -0
  27. data/lib/eco/api/microcases/people/fetch/with_each_leaver.rb +33 -0
  28. data/lib/eco/api/microcases/people/fetch/with_each_present.rb +42 -0
  29. data/lib/eco/api/microcases/people/fetch/with_each_starter.rb +43 -0
  30. data/lib/eco/api/microcases/people/fetch/with_each_subordinate.rb +41 -0
  31. data/lib/eco/api/microcases/people/fetch/with_supervisor.rb +46 -0
  32. data/lib/eco/api/microcases/people/fetch.rb +23 -0
  33. data/lib/eco/api/microcases/people/integrity/fix_default_group.rb +39 -0
  34. data/lib/eco/api/microcases/people/integrity/fix_filter_tags.rb +55 -0
  35. data/lib/eco/api/microcases/people/integrity/refresh_default_tag.rb +32 -0
  36. data/lib/eco/api/microcases/people/integrity.rb +17 -0
  37. data/lib/eco/api/microcases/people/macro/take_email.rb +141 -0
  38. data/lib/eco/api/microcases/people/macro.rb +13 -0
  39. data/lib/eco/api/microcases/people/manage/cache.rb +36 -0
  40. data/lib/eco/api/microcases/people/manage/load.rb +90 -0
  41. data/lib/eco/api/microcases/people/manage/refresh.rb +59 -0
  42. data/lib/eco/api/microcases/people/manage/search.rb +118 -0
  43. data/lib/eco/api/microcases/people/manage.rb +19 -0
  44. data/lib/eco/api/microcases/people/preserve/default_tag.rb +29 -0
  45. data/lib/eco/api/microcases/people/preserve/filter_tags.rb +34 -0
  46. data/lib/eco/api/microcases/people/preserve/policy_groups.rb +36 -0
  47. data/lib/eco/api/microcases/people/preserve.rb +17 -0
  48. data/lib/eco/api/microcases/people.rb +21 -0
  49. data/lib/eco/api/microcases/person_update.rb +1 -1
  50. data/lib/eco/api/microcases/s3upload_targets.rb +1 -1
  51. data/lib/eco/api/microcases/with_each_contractor_present.rb +40 -0
  52. data/lib/eco/api/microcases.rb +3 -23
  53. data/lib/eco/api/organization/people/multiple_search_results.rb +48 -0
  54. data/lib/eco/api/organization/{people_similarity.rb → people/similarity.rb} +89 -72
  55. data/lib/eco/api/organization/people.rb +40 -66
  56. data/lib/eco/api/organization.rb +0 -1
  57. data/lib/eco/api/policies/policy.rb +7 -5
  58. data/lib/eco/api/policies.rb +9 -4
  59. data/lib/eco/api/session/batch/feedback/generate.rb +60 -0
  60. data/lib/eco/api/session/batch/feedback/getters.rb +28 -0
  61. data/lib/eco/api/session/batch/feedback/identifiers.rb +20 -0
  62. data/lib/eco/api/session/batch/feedback/job_dependencies.rb +45 -0
  63. data/lib/eco/api/session/batch/feedback/request_stat.rb +27 -0
  64. data/lib/eco/api/session/batch/feedback/request_stats.rb +270 -0
  65. data/lib/eco/api/session/batch/feedback.rb +45 -119
  66. data/lib/eco/api/session/batch/job/sets.rb +23 -0
  67. data/lib/eco/api/session/batch/job/type.rb +22 -0
  68. data/lib/eco/api/session/batch/job.rb +8 -18
  69. data/lib/eco/api/session/batch/jobs.rb +6 -2
  70. data/lib/eco/api/session/batch/launcher/mode_size.rb +1 -1
  71. data/lib/eco/api/session/batch/launcher/retry.rb +4 -4
  72. data/lib/eco/api/session/batch/launcher.rb +2 -2
  73. data/lib/eco/api/session/batch/policies.rb +4 -4
  74. data/lib/eco/api/session/batch/searcher.rb +2 -1
  75. data/lib/eco/api/session/batch.rb +0 -1
  76. data/lib/eco/api/session/config/workflow.rb +19 -9
  77. data/lib/eco/api/usecases/base_case/model.rb +54 -0
  78. data/lib/eco/api/usecases/base_case/type.rb +52 -0
  79. data/lib/eco/api/usecases/base_case.rb +5 -29
  80. data/lib/eco/api/usecases/base_io/chaining.rb +48 -0
  81. data/lib/eco/api/usecases/base_io/validations.rb +114 -0
  82. data/lib/eco/api/usecases/base_io.rb +65 -115
  83. data/lib/eco/api/usecases/cli/dsl.rb +3 -1
  84. data/lib/eco/api/usecases/default/people/treat/analyse_people_case.rb +7 -4
  85. data/lib/eco/api/usecases/default/people/treat/supers_cyclic_identify_case.rb +1 -3
  86. data/lib/eco/api/usecases/default/people/treat/supers_hierarchy_case.rb +1 -5
  87. data/lib/eco/api/usecases/default_cases/entries_to_csv_case.rb +2 -2
  88. data/lib/eco/api/usecases/default_cases/hris_case.rb +0 -2
  89. data/lib/eco/api/usecases/default_cases/samples/sftp.rb +3 -0
  90. data/lib/eco/api/usecases/default_cases/samples.rb +1 -1
  91. data/lib/eco/api/usecases/default_cases/to_csv_case.rb +3 -6
  92. data/lib/eco/api/usecases/graphql/base.rb +3 -2
  93. data/lib/eco/api/usecases/graphql/helpers/base/case_env.rb +1 -1
  94. data/lib/eco/api/usecases/graphql/helpers/base/error_handling.rb +3 -3
  95. data/lib/eco/api/usecases/graphql/helpers/contractors/base/load.rb +17 -0
  96. data/lib/eco/api/usecases/graphql/helpers/contractors/base.rb +8 -0
  97. data/lib/eco/api/usecases/graphql/helpers/contractors.rb +6 -0
  98. data/lib/eco/api/usecases/graphql/helpers/location/base.rb +5 -4
  99. data/lib/eco/api/usecases/graphql/helpers/location/command.rb +2 -2
  100. data/lib/eco/api/usecases/graphql/helpers.rb +1 -0
  101. data/lib/eco/api/usecases/graphql/samples/contractors/dsl.rb +5 -0
  102. data/lib/eco/api/usecases/graphql/samples/contractors.rb +17 -0
  103. data/lib/eco/api/usecases/graphql/samples/location/service/base.rb +1 -1
  104. data/lib/eco/api/usecases/graphql/samples/location.rb +1 -1
  105. data/lib/eco/api/usecases/graphql/samples.rb +1 -0
  106. data/lib/eco/api/usecases/ooze_samples/ooze_base_case.rb +0 -1
  107. data/lib/eco/api/usecases/ooze_samples/ooze_run_base_case.rb +8 -8
  108. data/lib/eco/api/usecases/{default_cases/samples → samples/drivers}/cli/sftp_cli.rb +1 -1
  109. data/lib/eco/api/usecases/samples/drivers/cli/url_pull_cli.rb +15 -0
  110. data/lib/eco/api/usecases/{default_cases/samples/sftp_case.rb → samples/drivers/sftp_sample.rb} +8 -8
  111. data/lib/eco/api/usecases/samples/drivers/url_pull_sample.rb +110 -0
  112. data/lib/eco/api/usecases/samples/drivers.rb +13 -0
  113. data/lib/eco/api/usecases/samples.rb +11 -0
  114. data/lib/eco/api/usecases/use_case/chainer.rb +12 -0
  115. data/lib/eco/api/usecases/use_case.rb +32 -23
  116. data/lib/eco/api/usecases/use_case_chain/chaining.rb +88 -0
  117. data/lib/eco/api/usecases/use_case_chain.rb +17 -62
  118. data/lib/eco/api/usecases/use_case_io/chain.rb +24 -0
  119. data/lib/eco/api/usecases/use_case_io.rb +17 -22
  120. data/lib/eco/api/usecases.rb +15 -6
  121. data/lib/eco/assets.rb +1 -1
  122. data/lib/eco/cli/config/filters/people_filters.rb +6 -5
  123. data/lib/eco/cli/config/input.rb +6 -2
  124. data/lib/eco/cli/config/use_cases.rb +4 -2
  125. data/lib/eco/cli_default/people_filters.rb +1 -0
  126. data/lib/eco/cli_default/workflow.rb +149 -138
  127. data/lib/eco/data/mapper.rb +51 -19
  128. data/lib/eco/language/methods/dsl_able.rb +10 -0
  129. data/lib/eco/version.rb +1 -1
  130. metadata +87 -35
  131. data/lib/eco/api/microcases/account_excluded.rb +0 -26
  132. data/lib/eco/api/microcases/core_excluded.rb +0 -20
  133. data/lib/eco/api/microcases/fix_default_group.rb +0 -33
  134. data/lib/eco/api/microcases/fix_filter_tags.rb +0 -49
  135. data/lib/eco/api/microcases/people_cache.rb +0 -30
  136. data/lib/eco/api/microcases/people_load.rb +0 -84
  137. data/lib/eco/api/microcases/people_refresh.rb +0 -53
  138. data/lib/eco/api/microcases/people_search.rb +0 -112
  139. data/lib/eco/api/microcases/preserve_default_tag.rb +0 -23
  140. data/lib/eco/api/microcases/preserve_filter_tags.rb +0 -28
  141. data/lib/eco/api/microcases/preserve_policy_groups.rb +0 -30
  142. data/lib/eco/api/microcases/refresh_default_tag.rb +0 -26
  143. data/lib/eco/api/microcases/set_account.rb +0 -18
  144. data/lib/eco/api/microcases/set_core.rb +0 -17
  145. data/lib/eco/api/microcases/set_core_with_supervisor.rb +0 -32
  146. data/lib/eco/api/microcases/set_supervisor.rb +0 -63
  147. data/lib/eco/api/microcases/take_email_from_account.rb +0 -129
  148. data/lib/eco/api/microcases/with_each.rb +0 -103
  149. data/lib/eco/api/microcases/with_each_leaver.rb +0 -27
  150. data/lib/eco/api/microcases/with_each_present.rb +0 -36
  151. data/lib/eco/api/microcases/with_each_starter.rb +0 -37
  152. data/lib/eco/api/microcases/with_each_subordinate.rb +0 -33
  153. data/lib/eco/api/microcases/with_supervisor.rb +0 -35
  154. data/lib/eco/api/session/batch/request_stats.rb +0 -266
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: eco-helpers
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.21
4
+ version: 3.0.23
5
5
  platform: ruby
6
6
  authors:
7
7
  - Oscar Segura
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-12-16 00:00:00.000000000 Z
11
+ date: 2025-03-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -229,7 +229,7 @@ dependencies:
229
229
  version: '0.10'
230
230
  - - ">="
231
231
  - !ruby/object:Gem::Version
232
- version: 0.10.7
232
+ version: 0.10.8
233
233
  type: :runtime
234
234
  prerelease: false
235
235
  version_requirements: !ruby/object:Gem::Requirement
@@ -239,7 +239,7 @@ dependencies:
239
239
  version: '0.10'
240
240
  - - ">="
241
241
  - !ruby/object:Gem::Version
242
- version: 0.10.7
242
+ version: 0.10.8
243
243
  - !ruby/object:Gem::Dependency
244
244
  name: ecoportal-api-graphql
245
245
  requirement: !ruby/object:Gem::Requirement
@@ -249,7 +249,7 @@ dependencies:
249
249
  version: '0.4'
250
250
  - - ">="
251
251
  - !ruby/object:Gem::Version
252
- version: 0.4.3
252
+ version: 0.4.4
253
253
  type: :runtime
254
254
  prerelease: false
255
255
  version_requirements: !ruby/object:Gem::Requirement
@@ -259,7 +259,7 @@ dependencies:
259
259
  version: '0.4'
260
260
  - - ">="
261
261
  - !ruby/object:Gem::Version
262
- version: 0.4.3
262
+ version: 0.4.4
263
263
  - !ruby/object:Gem::Dependency
264
264
  name: ecoportal-api-v2
265
265
  requirement: !ruby/object:Gem::Requirement
@@ -269,7 +269,7 @@ dependencies:
269
269
  version: '2.0'
270
270
  - - ">="
271
271
  - !ruby/object:Gem::Version
272
- version: 2.0.12
272
+ version: 2.0.15
273
273
  type: :runtime
274
274
  prerelease: false
275
275
  version_requirements: !ruby/object:Gem::Requirement
@@ -279,7 +279,7 @@ dependencies:
279
279
  version: '2.0'
280
280
  - - ">="
281
281
  - !ruby/object:Gem::Version
282
- version: 2.0.12
282
+ version: 2.0.15
283
283
  - !ruby/object:Gem::Dependency
284
284
  name: ed25519
285
285
  requirement: !ruby/object:Gem::Requirement
@@ -374,6 +374,20 @@ dependencies:
374
374
  - - "<"
375
375
  - !ruby/object:Gem::Version
376
376
  version: '1.6'
377
+ - !ruby/object:Gem::Dependency
378
+ name: net-http
379
+ requirement: !ruby/object:Gem::Requirement
380
+ requirements:
381
+ - - "~>"
382
+ - !ruby/object:Gem::Version
383
+ version: 0.6.0
384
+ type: :runtime
385
+ prerelease: false
386
+ version_requirements: !ruby/object:Gem::Requirement
387
+ requirements:
388
+ - - "~>"
389
+ - !ruby/object:Gem::Version
390
+ version: 0.6.0
377
391
  - !ruby/object:Gem::Dependency
378
392
  name: net-sftp
379
393
  requirement: !ruby/object:Gem::Requirement
@@ -516,6 +530,7 @@ extensions: []
516
530
  extra_rdoc_files: []
517
531
  files:
518
532
  - ".gitignore"
533
+ - ".idea/.gitignore"
519
534
  - ".markdownlint.json"
520
535
  - ".rspec"
521
536
  - ".rubocop.yml"
@@ -541,11 +556,15 @@ files:
541
556
  - lib/eco/api/common/loaders/config/cli.rb
542
557
  - lib/eco/api/common/loaders/config/session.rb
543
558
  - lib/eco/api/common/loaders/config/workflow.rb
559
+ - lib/eco/api/common/loaders/config/workflow/cases_extension.rb
544
560
  - lib/eco/api/common/loaders/config/workflow/mailer.rb
545
561
  - lib/eco/api/common/loaders/error_handler.rb
546
562
  - lib/eco/api/common/loaders/parser.rb
547
563
  - lib/eco/api/common/loaders/policy.rb
548
564
  - lib/eco/api/common/loaders/use_case.rb
565
+ - lib/eco/api/common/loaders/use_case/cli_identify.rb
566
+ - lib/eco/api/common/loaders/use_case/target_model.rb
567
+ - lib/eco/api/common/loaders/use_case/type.rb
549
568
  - lib/eco/api/common/people.rb
550
569
  - lib/eco/api/common/people/base_parser.rb
551
570
  - lib/eco/api/common/people/default_parsers.rb
@@ -611,38 +630,47 @@ files:
611
630
  - lib/eco/api/error/handler.rb
612
631
  - lib/eco/api/error/handlers.rb
613
632
  - lib/eco/api/microcases.rb
614
- - lib/eco/api/microcases/account_excluded.rb
615
633
  - lib/eco/api/microcases/append_usergroups.rb
616
- - lib/eco/api/microcases/core_excluded.rb
617
- - lib/eco/api/microcases/fix_default_group.rb
618
- - lib/eco/api/microcases/fix_filter_tags.rb
619
- - lib/eco/api/microcases/people_cache.rb
620
- - lib/eco/api/microcases/people_load.rb
621
- - lib/eco/api/microcases/people_refresh.rb
622
- - lib/eco/api/microcases/people_search.rb
634
+ - lib/eco/api/microcases/people.rb
635
+ - lib/eco/api/microcases/people/apply_changes.rb
636
+ - lib/eco/api/microcases/people/apply_changes/set_account.rb
637
+ - lib/eco/api/microcases/people/apply_changes/set_account/account_excluded.rb
638
+ - lib/eco/api/microcases/people/apply_changes/set_core.rb
639
+ - lib/eco/api/microcases/people/apply_changes/set_core/core_excluded.rb
640
+ - lib/eco/api/microcases/people/apply_changes/set_core_with_supervisor.rb
641
+ - lib/eco/api/microcases/people/apply_changes/set_supervisor.rb
642
+ - lib/eco/api/microcases/people/fetch.rb
643
+ - lib/eco/api/microcases/people/fetch/with_each.rb
644
+ - lib/eco/api/microcases/people/fetch/with_each_leaver.rb
645
+ - lib/eco/api/microcases/people/fetch/with_each_present.rb
646
+ - lib/eco/api/microcases/people/fetch/with_each_starter.rb
647
+ - lib/eco/api/microcases/people/fetch/with_each_subordinate.rb
648
+ - lib/eco/api/microcases/people/fetch/with_supervisor.rb
649
+ - lib/eco/api/microcases/people/integrity.rb
650
+ - lib/eco/api/microcases/people/integrity/fix_default_group.rb
651
+ - lib/eco/api/microcases/people/integrity/fix_filter_tags.rb
652
+ - lib/eco/api/microcases/people/integrity/refresh_default_tag.rb
653
+ - lib/eco/api/microcases/people/macro.rb
654
+ - lib/eco/api/microcases/people/macro/take_email.rb
655
+ - lib/eco/api/microcases/people/manage.rb
656
+ - lib/eco/api/microcases/people/manage/cache.rb
657
+ - lib/eco/api/microcases/people/manage/load.rb
658
+ - lib/eco/api/microcases/people/manage/refresh.rb
659
+ - lib/eco/api/microcases/people/manage/search.rb
660
+ - lib/eco/api/microcases/people/preserve.rb
661
+ - lib/eco/api/microcases/people/preserve/default_tag.rb
662
+ - lib/eco/api/microcases/people/preserve/filter_tags.rb
663
+ - lib/eco/api/microcases/people/preserve/policy_groups.rb
623
664
  - lib/eco/api/microcases/person_update.rb
624
- - lib/eco/api/microcases/preserve_default_tag.rb
625
- - lib/eco/api/microcases/preserve_filter_tags.rb
626
- - lib/eco/api/microcases/preserve_policy_groups.rb
627
- - lib/eco/api/microcases/refresh_default_tag.rb
628
665
  - lib/eco/api/microcases/s3upload_targets.rb
629
- - lib/eco/api/microcases/set_account.rb
630
- - lib/eco/api/microcases/set_core.rb
631
- - lib/eco/api/microcases/set_core_with_supervisor.rb
632
- - lib/eco/api/microcases/set_supervisor.rb
633
666
  - lib/eco/api/microcases/strict_search.rb
634
- - lib/eco/api/microcases/take_email_from_account.rb
635
- - lib/eco/api/microcases/with_each.rb
636
- - lib/eco/api/microcases/with_each_leaver.rb
637
- - lib/eco/api/microcases/with_each_present.rb
638
- - lib/eco/api/microcases/with_each_starter.rb
639
- - lib/eco/api/microcases/with_each_subordinate.rb
640
- - lib/eco/api/microcases/with_supervisor.rb
667
+ - lib/eco/api/microcases/with_each_contractor_present.rb
641
668
  - lib/eco/api/organization.rb
642
669
  - lib/eco/api/organization/login_providers.rb
643
670
  - lib/eco/api/organization/node_classifications.rb
644
671
  - lib/eco/api/organization/people.rb
645
- - lib/eco/api/organization/people_similarity.rb
672
+ - lib/eco/api/organization/people/multiple_search_results.rb
673
+ - lib/eco/api/organization/people/similarity.rb
646
674
  - lib/eco/api/organization/person_schemas.rb
647
675
  - lib/eco/api/organization/policy_groups.rb
648
676
  - lib/eco/api/organization/preferences.rb
@@ -660,7 +688,15 @@ files:
660
688
  - lib/eco/api/session/batch/base_policy.rb
661
689
  - lib/eco/api/session/batch/errors.rb
662
690
  - lib/eco/api/session/batch/feedback.rb
691
+ - lib/eco/api/session/batch/feedback/generate.rb
692
+ - lib/eco/api/session/batch/feedback/getters.rb
693
+ - lib/eco/api/session/batch/feedback/identifiers.rb
694
+ - lib/eco/api/session/batch/feedback/job_dependencies.rb
695
+ - lib/eco/api/session/batch/feedback/request_stat.rb
696
+ - lib/eco/api/session/batch/feedback/request_stats.rb
663
697
  - lib/eco/api/session/batch/job.rb
698
+ - lib/eco/api/session/batch/job/sets.rb
699
+ - lib/eco/api/session/batch/job/type.rb
664
700
  - lib/eco/api/session/batch/jobs.rb
665
701
  - lib/eco/api/session/batch/jobs_groups.rb
666
702
  - lib/eco/api/session/batch/launcher.rb
@@ -671,7 +707,6 @@ files:
671
707
  - lib/eco/api/session/batch/launcher/status_handling.rb
672
708
  - lib/eco/api/session/batch/launcher/valid_methods.rb
673
709
  - lib/eco/api/session/batch/policies.rb
674
- - lib/eco/api/session/batch/request_stats.rb
675
710
  - lib/eco/api/session/batch/searcher.rb
676
711
  - lib/eco/api/session/batch/status.rb
677
712
  - lib/eco/api/session/config.rb
@@ -693,7 +728,11 @@ files:
693
728
  - lib/eco/api/session/config/workflow.rb
694
729
  - lib/eco/api/usecases.rb
695
730
  - lib/eco/api/usecases/base_case.rb
731
+ - lib/eco/api/usecases/base_case/model.rb
732
+ - lib/eco/api/usecases/base_case/type.rb
696
733
  - lib/eco/api/usecases/base_io.rb
734
+ - lib/eco/api/usecases/base_io/chaining.rb
735
+ - lib/eco/api/usecases/base_io/validations.rb
697
736
  - lib/eco/api/usecases/cli.rb
698
737
  - lib/eco/api/usecases/cli/dsl.rb
699
738
  - lib/eco/api/usecases/cli/option.rb
@@ -759,8 +798,7 @@ files:
759
798
  - lib/eco/api/usecases/default_cases/entries_to_csv_case.rb
760
799
  - lib/eco/api/usecases/default_cases/hris_case.rb
761
800
  - lib/eco/api/usecases/default_cases/samples.rb
762
- - lib/eco/api/usecases/default_cases/samples/cli/sftp_cli.rb
763
- - lib/eco/api/usecases/default_cases/samples/sftp_case.rb
801
+ - lib/eco/api/usecases/default_cases/samples/sftp.rb
764
802
  - lib/eco/api/usecases/default_cases/to_csv_case.rb
765
803
  - lib/eco/api/usecases/default_cases/to_csv_detailed_case.rb
766
804
  - lib/eco/api/usecases/default_cases/update_case.rb
@@ -772,6 +810,9 @@ files:
772
810
  - lib/eco/api/usecases/graphql/helpers/base/case_env.rb
773
811
  - lib/eco/api/usecases/graphql/helpers/base/error_handling.rb
774
812
  - lib/eco/api/usecases/graphql/helpers/base/graphql_env.rb
813
+ - lib/eco/api/usecases/graphql/helpers/contractors.rb
814
+ - lib/eco/api/usecases/graphql/helpers/contractors/base.rb
815
+ - lib/eco/api/usecases/graphql/helpers/contractors/base/load.rb
775
816
  - lib/eco/api/usecases/graphql/helpers/location.rb
776
817
  - lib/eco/api/usecases/graphql/helpers/location/base.rb
777
818
  - lib/eco/api/usecases/graphql/helpers/location/base/classifications_parser.rb
@@ -795,6 +836,8 @@ files:
795
836
  - lib/eco/api/usecases/graphql/helpers/location/tags_remap/tags_map.rb
796
837
  - lib/eco/api/usecases/graphql/helpers/location/tags_remap/tags_set.rb
797
838
  - lib/eco/api/usecases/graphql/samples.rb
839
+ - lib/eco/api/usecases/graphql/samples/contractors.rb
840
+ - lib/eco/api/usecases/graphql/samples/contractors/dsl.rb
798
841
  - lib/eco/api/usecases/graphql/samples/location.rb
799
842
  - lib/eco/api/usecases/graphql/samples/location/command.rb
800
843
  - lib/eco/api/usecases/graphql/samples/location/command/dsl.rb
@@ -843,9 +886,18 @@ files:
843
886
  - lib/eco/api/usecases/ooze_samples/register_migration_case.rb
844
887
  - lib/eco/api/usecases/ooze_samples/register_update_case.rb
845
888
  - lib/eco/api/usecases/ooze_samples/target_oozes_update_case.rb
889
+ - lib/eco/api/usecases/samples.rb
890
+ - lib/eco/api/usecases/samples/drivers.rb
891
+ - lib/eco/api/usecases/samples/drivers/cli/sftp_cli.rb
892
+ - lib/eco/api/usecases/samples/drivers/cli/url_pull_cli.rb
893
+ - lib/eco/api/usecases/samples/drivers/sftp_sample.rb
894
+ - lib/eco/api/usecases/samples/drivers/url_pull_sample.rb
846
895
  - lib/eco/api/usecases/use_case.rb
896
+ - lib/eco/api/usecases/use_case/chainer.rb
847
897
  - lib/eco/api/usecases/use_case_chain.rb
898
+ - lib/eco/api/usecases/use_case_chain/chaining.rb
848
899
  - lib/eco/api/usecases/use_case_io.rb
900
+ - lib/eco/api/usecases/use_case_io/chain.rb
849
901
  - lib/eco/assets.rb
850
902
  - lib/eco/assets/language.rb
851
903
  - lib/eco/cli.rb
@@ -1,26 +0,0 @@
1
- module Eco
2
- module API
3
- class MicroCases
4
- # @param person [Ecoportal::API::V1::Person] the person we want to update, carrying the changes to be done.
5
- # @param options [Hash] the options.
6
- # @return [Array<String>] the account parameters that should not be included.
7
- def account_excluded(person, options)
8
- [].tap do |account_excluded|
9
- unless person.new?
10
- if options.dig(:exclude, :policy_groups)
11
- account_excluded.push("policy_group_ids")
12
- end
13
-
14
- if options.dig(:exclude, :default_tag)
15
- account_excluded.push("default_tag")
16
- end
17
-
18
- if options.dig(:exclude, :login_providers)
19
- account_excluded.push("login_provider_ids")
20
- end
21
- end
22
- end
23
- end
24
- end
25
- end
26
- end
@@ -1,20 +0,0 @@
1
- module Eco
2
- module API
3
- class MicroCases
4
- # @note by default `supervisor_id` is always excluded.
5
- # @param person [Ecoportal::API::V1::Person] the person we want to update, carrying the changes to be done.
6
- # @param options [Hash] the options.
7
- # @return [Array<String>] the core parameters that should not be included.
8
- def core_excluded(person, options)
9
- ["supervisor_id"].tap do |core_excluded|
10
- can_exclude = person.new?? ["filter_tags"] : %w[name external_id email filter_tags]
11
-
12
- exclusions = can_exclude.select do |attr|
13
- options.dig(:exclude, attr.to_sym)
14
- end
15
- core_excluded.concat(exclusions)
16
- end
17
- end
18
- end
19
- end
20
- end
@@ -1,33 +0,0 @@
1
- module Eco
2
- module API
3
- class MicroCases
4
- # If defined, it sets the default usergroup, only when the `policy_group_ids` was not part of the input data.
5
- # @param entry [PersonEntry] the input entry with the data we should set on person.
6
- # @param person [Ecoportal::API::V1::Person] the person we want to update, carrying the changes to be done.
7
- # @param options [Hash] the options.
8
- def fix_default_group(entry, person, options)
9
- return if options.dig(:exclude, :account)
10
- return if options.dig(:exclude, :policy_groups) && !person.new?
11
-
12
- end_pg_ids = person.account.policy_group_ids
13
-
14
- if person.account_added? && __def_usergroup_id && !entry.policy_group_ids?
15
- # on account creation, if missing policy_group_ids column in the input
16
- # use default_usergroup, if it's defined
17
- end_pg_ids = [__def_usergroup_id]
18
- end
19
-
20
- person.account.policy_group_ids = end_pg_ids
21
- end
22
-
23
- private
24
-
25
- def __def_usergroup_id
26
- @__def_usergroup_id ||=
27
- if session.config.people.default_usergroup?
28
- session.policy_groups.to_id(session.config.people.default_usergroup)
29
- end
30
- end
31
- end
32
- end
33
- end
@@ -1,49 +0,0 @@
1
- module Eco
2
- module API
3
- class MicroCases
4
- # Helper that makes sure the **custom `tags`** are preserved.
5
- # @note
6
- # - this feature is essential to preserve custom `tags` in users that have register tags.
7
- # - for this to work out, it requires a `tagtree` to be defined.
8
- # @param person [Ecoportal::API::V1::Person] the person we want to update, carrying the changes already done.
9
- # @param options [Hash] the options.
10
- # @option options [Hash<Symbol, Object>] :filter_tags options around `filter_tags`.
11
- # * `:preserve_custom` (Boolean) [true] indicates if original tags that are not in the tree should be added/preserved.
12
- # * `:add_custom` (Boolean) [true] indicates if target tags that are not in the tree should be really added.
13
- def fix_filter_tags(person, options)
14
- return unless session.tagtree
15
-
16
- filter_tags_excluded =
17
- options.dig(:exclude, :core) ||
18
- options.dig(:exclude, :filter_tags)
19
-
20
- return if !person.new? && filter_tags_excluded
21
-
22
- person.filter_tags = session.tagtree.user_tags(
23
- initial: person.original_doc["filter_tags"] || [],
24
- final: person.filter_tags,
25
- preserve_custom: _fix_filter_tags_preserve_custom?(options),
26
- add_custom: _fix_filter_tags_add_custom?(options)
27
- )
28
- end
29
-
30
- private
31
-
32
- # default `true`
33
- def _fix_filter_tags_preserve_custom?(options)
34
- key_defined = options.key?(:filter_tags) && options[:filter_tags].key?(:preserve_custom)
35
- return true unless key_defined
36
-
37
- options.dig(:filter_tags, :preserve_custom)
38
- end
39
-
40
- # default `true`
41
- def _fix_filter_tags_add_custom?(options)
42
- key_defined = options.key?(:filter_tags) && options[:filter_tags].key?(:add_custom)
43
- return true unless key_defined
44
-
45
- options.dig(:filter_tags, :add_custom)
46
- end
47
- end
48
- end
49
- end
@@ -1,30 +0,0 @@
1
- module Eco
2
- module API
3
- class MicroCases
4
- # Helper to locally cache the people manager.
5
- # @param filename [String] the name of the file where the data should be cached.
6
- # @return [Eco::API::Organization::People] the `People` object with the data.
7
- def people_cache(filename = enviro.config.people.cache)
8
- log(:info) { "Going to get all the people via API" }
9
-
10
- start = Time.now
11
- people = session.batch.get_people
12
- secs = (Time.now - start).round(3)
13
- cnt = people.count
14
- per_sec = (cnt.to_f / secs).round(2)
15
-
16
- log(:info) {
17
- "Loaded #{cnt} people in #{secs} seconds (#{per_sec} people/sec)"
18
- }
19
-
20
- file = file_manager.save_json(people, filename, :timestamp)
21
-
22
- log(:info) {
23
- "#{people.length} people loaded and saved locally to #{file}."
24
- }
25
-
26
- Eco::API::Organization::People.new(people)
27
- end
28
- end
29
- end
30
- end
@@ -1,84 +0,0 @@
1
- module Eco
2
- module API
3
- class MicroCases
4
- # Helper to load `People` that works in different phases:
5
- # 1. first tries to get the newest cached file that follows `filename` pattern
6
- # - if not the newest, it tries to find the specific filename
7
- # 2. if it succeeds to identify a cached file, it loads it
8
- # - if it fails, it tries to get people from the server
9
- # @note
10
- # - `filename` will be relative to the working directory (the one of the session `enviro` set by the user).
11
- # @param filename [String] the name of the file where the cached data is to be found.
12
- # @param modifier [Array<Symbol>] modifiers to specify how this function should proceed:
13
- # - `:newest` if it should try to find the newest file (pattern alike).
14
- # - `:api` if it should try to get people from the server in case there's no cache.
15
- # - `:file` if it is supposed to load people from a file.
16
- # - `:save` if it is supposed to cache/save the data locally once obtained people from the server (`:api`)
17
- # @return [Eco::API::Organization::People] the `People` object with the data.
18
- def people_load(filename = enviro.config.people.cache, modifier: %i[newest api]) # rubocop:disable Metrics/AbcSize
19
- modifier = [modifier].flatten
20
- load_file = %i[file newest].any? {|flag| modifier.include?(flag)}
21
-
22
- case
23
- when filename && load_file
24
- file = people_load_filename(filename, newest: modifier.include?(:newest))
25
-
26
- if file
27
- file_manager.load_json(file).tap do |people|
28
- next unless people.is_a?(Array)
29
-
30
- log(:info) {
31
- "#{people&.length} people loaded from file #{file}"
32
- }
33
- end
34
- else
35
- log(:error) {
36
- "could not find the file #{file_manager.dir.file(filename)}"
37
- }
38
-
39
- exit unless modifier.include?(:api)
40
-
41
- people_load(modifier: modifier - %i[newest file])
42
- end
43
- when modifier.include?(:api)
44
- log(:info) { "Going to get all the people via API (load)" }
45
-
46
- start = Time.now
47
- session.batch.get_people.tap do |people|
48
- secs = (Time.now - start).round(3)
49
- cnt = people.count
50
- per_sec = (cnt.to_f / secs).round(2)
51
-
52
- log(:info) {
53
- "Loaded #{cnt} people in #{secs} seconds (#{per_sec} people/sec)"
54
- }
55
-
56
- if modifier.include?(:save) && people && people.length.positive?
57
- file = file_manager.save_json(people, filename, :timestamp)
58
- log(:info) { "#{people.length} people saved to file #{file}." }
59
- end
60
- end
61
- end.then do |people|
62
- Eco::API::Organization::People.new(people)
63
- end
64
- end
65
-
66
- private
67
-
68
- def people_load_filename(filename, newest: false)
69
- if newest
70
- # search input file based on pattern (in case the name has a timestamp)
71
- file_manager.dir.newest_file(file: filename).tap do |file|
72
- next unless file
73
-
74
- log(:info) {
75
- "previous file found: #{file}"
76
- }
77
- end
78
- else
79
- file_manager.dir.file(filename, should_exist: true)
80
- end
81
- end
82
- end
83
- end
84
- end
@@ -1,53 +0,0 @@
1
- module Eco
2
- module API
3
- class MicroCases
4
- # Helper to obtain all the elements of `people` anew from the _People Manager_.
5
- # @note
6
- # 1. This helper is normally used to run consecutive usecases, where data needs refresh.
7
- # 2. It only includes new people if they are not dirty (they do not have pending updates)
8
- # - This contingency wouldn't be necessary if the server worked perfectly.
9
- # @param people [Eco::API::Organization::People] the people that needs refresh.
10
- # @param include_created [Boolean] include people created during this session? (will check `:create` batch jobs).
11
- # @return [Eco::API::Organization::People] the `People` object with the data.
12
- def people_refresh(people:, include_created: true) # rubocop:disable Metrics/AbcSize
13
- people = people.newFrom people.select do |person|
14
- !person.new? || !person.dirty?
15
- end
16
-
17
- ini = people.length
18
-
19
- if include_created
20
- session.job_groups.find_jobs(type: :create).map do |job|
21
- to_add = job.people.reject(&:dirty?)
22
- people = people.merge(to_add)
23
- end
24
- end
25
-
26
- created = people.length - ini
27
- msg = "Going to refresh #{people.length} people with server data"
28
- msg << " (including #{created} that were created)" if created.positive?
29
- log(:info) { msg }
30
-
31
- start = Time.now
32
- entries = session.batch.get_people(people, silent: true)
33
- secs = (Time.now - start).round(3)
34
- cnt = entries.count
35
- per_sec = (cnt.to_f / secs).round(2)
36
-
37
- log(:info) {
38
- "Re-loaded #{cnt} people (out of #{people.length}) in #{secs} seconds (#{per_sec} people/sec)"
39
- }
40
-
41
- missing = people.length - entries.length
42
-
43
- if missing.positive?
44
- log(:error) {
45
- "Missed to obtain #{missing} people during the refresh"
46
- }
47
- end
48
-
49
- Eco::API::Organization::People.new(entries)
50
- end
51
- end
52
- end
53
- end