ecoportal-api-graphql 2.0.0 → 2.2.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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +363 -1
- data/LICENSE +21 -21
- data/README.md +24 -24
- data/lib/ecoportal/api/common/graphql/auth_service.rb +115 -115
- data/lib/ecoportal/api/common/graphql/class_helpers.rb +46 -46
- data/lib/ecoportal/api/common/graphql/client.rb +69 -69
- data/lib/ecoportal/api/common/graphql/hash_helpers.rb +105 -105
- data/lib/ecoportal/api/common/graphql/http_client.rb +85 -2
- data/lib/ecoportal/api/common/graphql/model/as_input.rb +54 -54
- data/lib/ecoportal/api/common/graphql/model/diffable/classic_diff_service.rb +49 -49
- data/lib/ecoportal/api/common/graphql/model/diffable/diff_service.rb +188 -188
- data/lib/ecoportal/api/common/graphql/model/diffable/hash_diff.rb +55 -55
- data/lib/ecoportal/api/common/graphql/model/diffable/hash_diff_nesting.rb +295 -295
- data/lib/ecoportal/api/common/graphql/model.rb +17 -17
- data/lib/ecoportal/api/common/graphql/patches.rb +1 -1
- data/lib/ecoportal/api/common/graphql/query_integration.rb +45 -45
- data/lib/ecoportal/api/common/graphql.rb +16 -16
- data/lib/ecoportal/api/common.graphql.rb +8 -8
- data/lib/ecoportal/api/graphql/base/action_category.rb +15 -15
- data/lib/ecoportal/api/graphql/base/ai_summary_version.rb +1 -1
- data/lib/ecoportal/api/graphql/base/contractor_entity.rb +24 -24
- data/lib/ecoportal/api/graphql/base/date_time.rb +12 -12
- data/lib/ecoportal/api/graphql/base/delta_result.rb +16 -16
- data/lib/ecoportal/api/graphql/base/field.rb +12 -12
- data/lib/ecoportal/api/graphql/base/file_attachment.rb +15 -15
- data/lib/ecoportal/api/graphql/base/location_node.rb +14 -14
- data/lib/ecoportal/api/graphql/base/location_structure/draft/structure.rb +37 -37
- data/lib/ecoportal/api/graphql/base/location_structure/draft.rb +93 -93
- data/lib/ecoportal/api/graphql/base/page/data_field/actions_list.rb +9 -9
- data/lib/ecoportal/api/graphql/base/page/data_field/ai_summary.rb +18 -18
- data/lib/ecoportal/api/graphql/base/page/data_field/checklist.rb +29 -29
- data/lib/ecoportal/api/graphql/base/page/data_field/cross_reference.rb +1 -1
- data/lib/ecoportal/api/graphql/base/page/data_field/date_field.rb +23 -23
- data/lib/ecoportal/api/graphql/base/page/data_field/geo.rb +24 -24
- data/lib/ecoportal/api/graphql/base/page/data_field/image_gallery.rb +1 -1
- data/lib/ecoportal/api/graphql/base/page/data_field/law.rb +8 -8
- data/lib/ecoportal/api/graphql/base/page/data_field/mailbox.rb +9 -9
- data/lib/ecoportal/api/graphql/base/page/data_field/plain_text.rb +17 -17
- data/lib/ecoportal/api/graphql/base/page/data_field/rich_text.rb +26 -26
- data/lib/ecoportal/api/graphql/base/page/data_field/signature.rb +9 -9
- data/lib/ecoportal/api/graphql/base/page/data_field/smart_fill.rb +17 -17
- data/lib/ecoportal/api/graphql/base/page/data_field/table.rb +9 -9
- data/lib/ecoportal/api/graphql/base/page/data_field/tag_field.rb +21 -21
- data/lib/ecoportal/api/graphql/base/page/phased/stage.rb +51 -0
- data/lib/ecoportal/api/graphql/base/page/phased.rb +15 -15
- data/lib/ecoportal/api/graphql/base/page/section.rb +48 -48
- data/lib/ecoportal/api/graphql/base/page_info.rb +12 -12
- data/lib/ecoportal/api/graphql/base/pages_workflow/operation_interface.rb +39 -39
- data/lib/ecoportal/api/graphql/base/pages_workflow/operations/assign_to.rb +27 -27
- data/lib/ecoportal/api/graphql/base/pages_workflow/operations/send_notification.rb +30 -30
- data/lib/ecoportal/api/graphql/base/pages_workflow/recipient_config.rb +34 -34
- data/lib/ecoportal/api/graphql/base/pages_workflow.rb +35 -35
- data/lib/ecoportal/api/graphql/base/person_member.rb +22 -22
- data/lib/ecoportal/api/graphql/base/preview_page.rb +23 -23
- data/lib/ecoportal/api/graphql/base/register.rb +1 -1
- data/lib/ecoportal/api/graphql/base/resource.rb +13 -13
- data/lib/ecoportal/api/graphql/base/template/change_log_entry.rb +118 -0
- data/lib/ecoportal/api/graphql/base/template.rb +2 -0
- data/lib/ecoportal/api/graphql/builder/action.rb +41 -41
- data/lib/ecoportal/api/graphql/builder/location_structure/draft.rb +64 -64
- data/lib/ecoportal/api/graphql/builder/location_structure.rb +40 -40
- data/lib/ecoportal/api/graphql/builder/register/preset_view.rb +84 -84
- data/lib/ecoportal/api/graphql/builder/register.rb +49 -49
- data/lib/ecoportal/api/graphql/builder/template.rb +28 -0
- data/lib/ecoportal/api/graphql/builder/template_builder.rb +21 -2
- data/lib/ecoportal/api/graphql/compat/page_reference.rb +23 -23
- data/lib/ecoportal/api/graphql/compat/registers.rb +84 -84
- data/lib/ecoportal/api/graphql/compat/search_results.rb +33 -33
- data/lib/ecoportal/api/graphql/compat.rb +17 -17
- data/lib/ecoportal/api/graphql/concerns/data_field_access.rb +71 -71
- data/lib/ecoportal/api/graphql/concerns/fragment_definitions.rb +68 -68
- data/lib/ecoportal/api/graphql/concerns/snake_camel_access.rb +60 -60
- data/lib/ecoportal/api/graphql/connection/preset_view.rb +11 -11
- data/lib/ecoportal/api/graphql/connection/template_change_log.rb +19 -0
- data/lib/ecoportal/api/graphql/connection.rb +1 -0
- data/lib/ecoportal/api/graphql/diff/change.rb +7 -2
- data/lib/ecoportal/api/graphql/diff/command_synthesizer.rb +19 -1
- data/lib/ecoportal/api/graphql/diff/version_diff.rb +13 -6
- data/lib/ecoportal/api/graphql/error/locations_error/fetch_nested.rb +51 -51
- data/lib/ecoportal/api/graphql/error/locations_error.rb +28 -28
- data/lib/ecoportal/api/graphql/error/locations_validation_error.rb +20 -20
- data/lib/ecoportal/api/graphql/error/validation_errors.rb +28 -28
- data/lib/ecoportal/api/graphql/error.rb +12 -12
- data/lib/ecoportal/api/graphql/file_upload.rb +10 -10
- data/lib/ecoportal/api/graphql/fragment/action.rb +65 -65
- data/lib/ecoportal/api/graphql/fragment/action_category.rb +17 -17
- data/lib/ecoportal/api/graphql/fragment/contractor_entity.rb +20 -20
- data/lib/ecoportal/api/graphql/fragment/locations_error.rb +19 -19
- data/lib/ecoportal/api/graphql/fragment/page.rb +1 -0
- data/lib/ecoportal/api/graphql/fragment/pages/common_page_union.rb +2 -0
- data/lib/ecoportal/api/graphql/fragment/pages.rb +15 -15
- data/lib/ecoportal/api/graphql/fragment/pagination.rb +17 -17
- data/lib/ecoportal/api/graphql/fragment/template_change_log.rb +102 -0
- data/lib/ecoportal/api/graphql/fragment.rb +1 -0
- data/lib/ecoportal/api/graphql/helpers/locations_tree.rb +41 -41
- data/lib/ecoportal/api/graphql/helpers.rb +10 -10
- data/lib/ecoportal/api/graphql/input/action/archive.rb +14 -14
- data/lib/ecoportal/api/graphql/input/action/create.rb +13 -13
- data/lib/ecoportal/api/graphql/input/action.rb +14 -14
- data/lib/ecoportal/api/graphql/input/contractor_entity/create.rb +14 -14
- data/lib/ecoportal/api/graphql/input/contractor_entity/destroy.rb +13 -13
- data/lib/ecoportal/api/graphql/input/delta_input.rb +16 -16
- data/lib/ecoportal/api/graphql/input/id_diff.rb +11 -11
- data/lib/ecoportal/api/graphql/input/location_structure/archive_command.rb +13 -13
- data/lib/ecoportal/api/graphql/input/location_structure/delete_command.rb +13 -13
- data/lib/ecoportal/api/graphql/input/location_structure/draft/create.rb +15 -15
- data/lib/ecoportal/api/graphql/input/location_structure/draft/delete.rb +15 -15
- data/lib/ecoportal/api/graphql/input/location_structure/draft/drop_bad_commands.rb +16 -16
- data/lib/ecoportal/api/graphql/input/location_structure/draft/publish.rb +16 -16
- data/lib/ecoportal/api/graphql/input/location_structure/draft.rb +19 -19
- data/lib/ecoportal/api/graphql/input/location_structure/insert_command.rb +21 -13
- data/lib/ecoportal/api/graphql/input/location_structure/move_command.rb +14 -14
- data/lib/ecoportal/api/graphql/input/location_structure/reorder_command.rb +13 -13
- data/lib/ecoportal/api/graphql/input/location_structure/unarchive_command.rb +13 -13
- data/lib/ecoportal/api/graphql/input/location_structure.rb +20 -20
- data/lib/ecoportal/api/graphql/input/page/archive.rb +14 -14
- data/lib/ecoportal/api/graphql/input/page/build_from_template.rb +13 -13
- data/lib/ecoportal/api/graphql/input/page/create_draft.rb +13 -13
- data/lib/ecoportal/api/graphql/input/page/create_from_template.rb +18 -18
- data/lib/ecoportal/api/graphql/input/page/delete_draft.rb +13 -13
- data/lib/ecoportal/api/graphql/input/page/publish_draft.rb +13 -13
- data/lib/ecoportal/api/graphql/input/page/review_task.rb +27 -14
- data/lib/ecoportal/api/graphql/input/page/unarchive.rb +14 -14
- data/lib/ecoportal/api/graphql/input/page.rb +26 -26
- data/lib/ecoportal/api/graphql/input/preset_view/create.rb +18 -18
- data/lib/ecoportal/api/graphql/input/preset_view/permission.rb +16 -16
- data/lib/ecoportal/api/graphql/input/preset_view/update.rb +1 -1
- data/lib/ecoportal/api/graphql/input/preset_view.rb +14 -14
- data/lib/ecoportal/api/graphql/input/register/create.rb +18 -18
- data/lib/ecoportal/api/graphql/input/register/update.rb +15 -15
- data/lib/ecoportal/api/graphql/input/register.rb +13 -13
- data/lib/ecoportal/api/graphql/input/search.rb +13 -13
- data/lib/ecoportal/api/graphql/input/search_conf/ai_generator.rb +234 -234
- data/lib/ecoportal/api/graphql/input/search_filter.rb +12 -12
- data/lib/ecoportal/api/graphql/input/search_sorter.rb +11 -11
- data/lib/ecoportal/api/graphql/input/workflow_command/add_action_tag.rb +18 -18
- data/lib/ecoportal/api/graphql/input/workflow_command/add_binding.rb +18 -18
- data/lib/ecoportal/api/graphql/input/workflow_command/add_comment_tagging_user_group.rb +18 -18
- data/lib/ecoportal/api/graphql/input/workflow_command/add_default_direct_strategy_user.rb +18 -18
- data/lib/ecoportal/api/graphql/input/workflow_command/add_default_strategy.rb +18 -18
- data/lib/ecoportal/api/graphql/input/workflow_command/add_direct_strategy_user.rb +18 -18
- data/lib/ecoportal/api/graphql/input/workflow_command/add_field.rb +10 -9
- data/lib/ecoportal/api/graphql/input/workflow_command/add_force.rb +18 -18
- data/lib/ecoportal/api/graphql/input/workflow_command/add_linked_field_config.rb +23 -23
- data/lib/ecoportal/api/graphql/input/workflow_command/add_linked_helper.rb +18 -18
- data/lib/ecoportal/api/graphql/input/workflow_command/add_operation.rb +18 -18
- data/lib/ecoportal/api/graphql/input/workflow_command/add_operation_direct_strategy_user.rb +18 -18
- data/lib/ecoportal/api/graphql/input/workflow_command/add_operation_strategy.rb +18 -18
- data/lib/ecoportal/api/graphql/input/workflow_command/add_recipient_action_type.rb +18 -18
- data/lib/ecoportal/api/graphql/input/workflow_command/add_recipient_filter.rb +18 -18
- data/lib/ecoportal/api/graphql/input/workflow_command/add_recipient_people_field.rb +18 -18
- data/lib/ecoportal/api/graphql/input/workflow_command/add_recipient_task_config.rb +18 -18
- data/lib/ecoportal/api/graphql/input/workflow_command/add_recipient_user.rb +18 -18
- data/lib/ecoportal/api/graphql/input/workflow_command/add_scheduled_callback.rb +23 -23
- data/lib/ecoportal/api/graphql/input/workflow_command/add_scheduled_callback_action.rb +18 -18
- data/lib/ecoportal/api/graphql/input/workflow_command/add_section.rb +18 -18
- data/lib/ecoportal/api/graphql/input/workflow_command/add_select_field_option.rb +25 -19
- data/lib/ecoportal/api/graphql/input/workflow_command/add_stage_section.rb +18 -18
- data/lib/ecoportal/api/graphql/input/workflow_command/add_stage_tag.rb +18 -18
- data/lib/ecoportal/api/graphql/input/workflow_command/add_strategy.rb +18 -18
- data/lib/ecoportal/api/graphql/input/workflow_command/add_task.rb +18 -18
- data/lib/ecoportal/api/graphql/input/workflow_command/add_task_assignment_user_group.rb +18 -18
- data/lib/ecoportal/api/graphql/input/workflow_command/add_workflow_callback.rb +18 -18
- data/lib/ecoportal/api/graphql/input/workflow_command/collapse_section.rb +18 -18
- data/lib/ecoportal/api/graphql/input/workflow_command/edit_binding.rb +18 -18
- data/lib/ecoportal/api/graphql/input/workflow_command/edit_creator_permissions.rb +18 -18
- data/lib/ecoportal/api/graphql/input/workflow_command/edit_default_strategy.rb +18 -18
- data/lib/ecoportal/api/graphql/input/workflow_command/edit_field_configuration.rb +7 -2
- data/lib/ecoportal/api/graphql/input/workflow_command/edit_force.rb +21 -18
- data/lib/ecoportal/api/graphql/input/workflow_command/edit_gauge_field_stop.rb +19 -19
- data/lib/ecoportal/api/graphql/input/workflow_command/edit_linked_field_config.rb +19 -19
- data/lib/ecoportal/api/graphql/input/workflow_command/edit_linked_helper.rb +18 -18
- data/lib/ecoportal/api/graphql/input/workflow_command/edit_operation.rb +18 -18
- data/lib/ecoportal/api/graphql/input/workflow_command/edit_operation_strategy.rb +18 -18
- data/lib/ecoportal/api/graphql/input/workflow_command/edit_reminder.rb +18 -18
- data/lib/ecoportal/api/graphql/input/workflow_command/edit_required_sign_offs.rb +18 -18
- data/lib/ecoportal/api/graphql/input/workflow_command/edit_restrict_comment_tagging.rb +18 -18
- data/lib/ecoportal/api/graphql/input/workflow_command/edit_restrict_task_assignment.rb +18 -18
- data/lib/ecoportal/api/graphql/input/workflow_command/edit_scheduled_callback.rb +22 -22
- data/lib/ecoportal/api/graphql/input/workflow_command/edit_section_header.rb +18 -18
- data/lib/ecoportal/api/graphql/input/workflow_command/edit_select_field_option.rb +23 -19
- data/lib/ecoportal/api/graphql/input/workflow_command/edit_stage.rb +18 -18
- data/lib/ecoportal/api/graphql/input/workflow_command/edit_strategy.rb +18 -18
- data/lib/ecoportal/api/graphql/input/workflow_command/edit_task_due.rb +18 -18
- data/lib/ecoportal/api/graphql/input/workflow_command/edit_template_basic_settings.rb +7 -2
- data/lib/ecoportal/api/graphql/input/workflow_command/edit_trigger.rb +18 -18
- data/lib/ecoportal/api/graphql/input/workflow_command/expand_section.rb +18 -18
- data/lib/ecoportal/api/graphql/input/workflow_command/field_config/contractor_entities.rb +28 -24
- data/lib/ecoportal/api/graphql/input/workflow_command/field_config/cross_reference.rb +8 -2
- data/lib/ecoportal/api/graphql/input/workflow_command/field_config/gauge.rb +20 -20
- data/lib/ecoportal/api/graphql/input/workflow_command/field_config/location_field.rb +24 -24
- data/lib/ecoportal/api/graphql/input/workflow_command/field_config/plain_text.rb +8 -2
- data/lib/ecoportal/api/graphql/input/workflow_command/field_config/signature.rb +20 -20
- data/lib/ecoportal/api/graphql/input/workflow_command/field_config/table.rb +25 -25
- data/lib/ecoportal/api/graphql/input/workflow_command/manage_copy_page_configuration.rb +47 -0
- data/lib/ecoportal/api/graphql/input/workflow_command/move_stage.rb +18 -18
- data/lib/ecoportal/api/graphql/input/workflow_command/remove_action_tag.rb +18 -18
- data/lib/ecoportal/api/graphql/input/workflow_command/remove_binding.rb +18 -18
- data/lib/ecoportal/api/graphql/input/workflow_command/remove_callback.rb +18 -18
- data/lib/ecoportal/api/graphql/input/workflow_command/remove_comment_tagging_user_group.rb +18 -18
- data/lib/ecoportal/api/graphql/input/workflow_command/remove_default_direct_strategy_user.rb +18 -18
- data/lib/ecoportal/api/graphql/input/workflow_command/remove_default_strategy.rb +18 -18
- data/lib/ecoportal/api/graphql/input/workflow_command/remove_direct_strategy_user.rb +18 -18
- data/lib/ecoportal/api/graphql/input/workflow_command/remove_field.rb +18 -18
- data/lib/ecoportal/api/graphql/input/workflow_command/remove_force.rb +18 -18
- data/lib/ecoportal/api/graphql/input/workflow_command/remove_linked_helper.rb +18 -18
- data/lib/ecoportal/api/graphql/input/workflow_command/remove_operation.rb +18 -18
- data/lib/ecoportal/api/graphql/input/workflow_command/remove_operation_direct_strategy_user.rb +18 -18
- data/lib/ecoportal/api/graphql/input/workflow_command/remove_operation_strategy.rb +18 -18
- data/lib/ecoportal/api/graphql/input/workflow_command/remove_recipient_action_type.rb +18 -18
- data/lib/ecoportal/api/graphql/input/workflow_command/remove_recipient_filter.rb +18 -18
- data/lib/ecoportal/api/graphql/input/workflow_command/remove_recipient_people_field.rb +18 -18
- data/lib/ecoportal/api/graphql/input/workflow_command/remove_recipient_task_config.rb +18 -18
- data/lib/ecoportal/api/graphql/input/workflow_command/remove_recipient_user.rb +18 -18
- data/lib/ecoportal/api/graphql/input/workflow_command/remove_scheduled_callback.rb +18 -18
- data/lib/ecoportal/api/graphql/input/workflow_command/remove_section.rb +18 -18
- data/lib/ecoportal/api/graphql/input/workflow_command/remove_stage.rb +18 -18
- data/lib/ecoportal/api/graphql/input/workflow_command/remove_stage_section.rb +18 -18
- data/lib/ecoportal/api/graphql/input/workflow_command/remove_stage_tag.rb +18 -18
- data/lib/ecoportal/api/graphql/input/workflow_command/remove_strategy.rb +18 -18
- data/lib/ecoportal/api/graphql/input/workflow_command/remove_task.rb +18 -18
- data/lib/ecoportal/api/graphql/input/workflow_command/remove_task_assignment_user_group.rb +18 -18
- data/lib/ecoportal/api/graphql/input/workflow_command/remove_task_due.rb +18 -18
- data/lib/ecoportal/api/graphql/input/workflow_command/remove_task_priority_level.rb +18 -18
- data/lib/ecoportal/api/graphql/input/workflow_command.rb +3 -0
- data/lib/ecoportal/api/graphql/interface/base_page.rb +14 -0
- data/lib/ecoportal/api/graphql/interface/location_structure/node.rb +43 -43
- data/lib/ecoportal/api/graphql/interface/location_structure.rb +14 -14
- data/lib/ecoportal/api/graphql/interface.rb +11 -11
- data/lib/ecoportal/api/graphql/logic/base_model.rb +15 -15
- data/lib/ecoportal/api/graphql/logic/base_query.rb +260 -193
- data/lib/ecoportal/api/graphql/logic/mutation.rb +59 -59
- data/lib/ecoportal/api/graphql/logic/payload.rb +42 -42
- data/lib/ecoportal/api/graphql/logic/query.rb +23 -23
- data/lib/ecoportal/api/graphql/logic/query_array.rb +30 -30
- data/lib/ecoportal/api/graphql/logic/query_connection.rb +48 -48
- data/lib/ecoportal/api/graphql/logic.rb +18 -18
- data/lib/ecoportal/api/graphql/model/account.rb +15 -15
- data/lib/ecoportal/api/graphql/model/action.rb +22 -22
- data/lib/ecoportal/api/graphql/model/ai_summary_version.rb +10 -10
- data/lib/ecoportal/api/graphql/model/contractor_entity.rb +12 -12
- data/lib/ecoportal/api/graphql/model/field.rb +10 -10
- data/lib/ecoportal/api/graphql/model/file_attachment.rb +10 -10
- data/lib/ecoportal/api/graphql/model/file_container.rb +11 -11
- data/lib/ecoportal/api/graphql/model/location_node.rb +14 -14
- data/lib/ecoportal/api/graphql/model/location_structure/draft/structure.rb +15 -15
- data/lib/ecoportal/api/graphql/model/location_structure/draft.rb +15 -15
- data/lib/ecoportal/api/graphql/model/location_structure.rb +16 -16
- data/lib/ecoportal/api/graphql/model/organization.rb +9 -0
- data/lib/ecoportal/api/graphql/model/page/basic.rb +14 -14
- data/lib/ecoportal/api/graphql/model/page/data_field.rb +12 -12
- data/lib/ecoportal/api/graphql/model/page/phased/stage.rb +14 -14
- data/lib/ecoportal/api/graphql/model/page/phased.rb +17 -0
- data/lib/ecoportal/api/graphql/model/page/section.rb +12 -12
- data/lib/ecoportal/api/graphql/model/page_union.rb +21 -21
- data/lib/ecoportal/api/graphql/model/pages_workflow.rb +20 -20
- data/lib/ecoportal/api/graphql/model/preset_view.rb +10 -10
- data/lib/ecoportal/api/graphql/model/preview_page.rb +10 -10
- data/lib/ecoportal/api/graphql/model/register.rb +10 -10
- data/lib/ecoportal/api/graphql/model/resource.rb +13 -13
- data/lib/ecoportal/api/graphql/model/template/change_log_entry.rb +19 -0
- data/lib/ecoportal/api/graphql/model/template.rb +4 -1
- data/lib/ecoportal/api/graphql/model/user.rb +14 -14
- data/lib/ecoportal/api/graphql/mutation/action/archive.rb +41 -41
- data/lib/ecoportal/api/graphql/mutation/action/create.rb +40 -40
- data/lib/ecoportal/api/graphql/mutation/action/update.rb +40 -40
- data/lib/ecoportal/api/graphql/mutation/action.rb +14 -14
- data/lib/ecoportal/api/graphql/mutation/ai_summary/generate.rb +1 -1
- data/lib/ecoportal/api/graphql/mutation/ai_summary/submit_feedback.rb +1 -1
- data/lib/ecoportal/api/graphql/mutation/ai_summary.rb +13 -13
- data/lib/ecoportal/api/graphql/mutation/contractor_entity/create.rb +40 -40
- data/lib/ecoportal/api/graphql/mutation/contractor_entity/destroy.rb +40 -40
- data/lib/ecoportal/api/graphql/mutation/contractor_entity/update.rb +40 -40
- data/lib/ecoportal/api/graphql/mutation/location_structure/apply_commands.rb +54 -54
- data/lib/ecoportal/api/graphql/mutation/location_structure/draft/add_commands.rb +55 -55
- data/lib/ecoportal/api/graphql/mutation/location_structure/draft/create.rb +54 -54
- data/lib/ecoportal/api/graphql/mutation/location_structure/draft/delete.rb +43 -43
- data/lib/ecoportal/api/graphql/mutation/location_structure/draft/drop_bad_commands.rb +56 -56
- data/lib/ecoportal/api/graphql/mutation/location_structure/draft/publish.rb +66 -66
- data/lib/ecoportal/api/graphql/mutation/location_structure/draft.rb +18 -18
- data/lib/ecoportal/api/graphql/mutation/location_structure.rb +13 -13
- data/lib/ecoportal/api/graphql/mutation/page/approve_review_task.rb +1 -1
- data/lib/ecoportal/api/graphql/mutation/page/archive.rb +40 -40
- data/lib/ecoportal/api/graphql/mutation/page/batch_update_review_task.rb +1 -1
- data/lib/ecoportal/api/graphql/mutation/page/build_from_template.rb +50 -50
- data/lib/ecoportal/api/graphql/mutation/page/create_draft.rb +1 -1
- data/lib/ecoportal/api/graphql/mutation/page/create_from_template.rb +43 -43
- data/lib/ecoportal/api/graphql/mutation/page/delete_draft.rb +1 -1
- data/lib/ecoportal/api/graphql/mutation/page/publish_draft.rb +1 -1
- data/lib/ecoportal/api/graphql/mutation/page/reject_review_task.rb +1 -1
- data/lib/ecoportal/api/graphql/mutation/page/restart_review_task.rb +1 -1
- data/lib/ecoportal/api/graphql/mutation/page/unarchive.rb +40 -40
- data/lib/ecoportal/api/graphql/mutation/page/undo_review_task.rb +1 -1
- data/lib/ecoportal/api/graphql/mutation/page/update.rb +40 -40
- data/lib/ecoportal/api/graphql/mutation/page.rb +28 -28
- data/lib/ecoportal/api/graphql/mutation/preset_view/create.rb +35 -35
- data/lib/ecoportal/api/graphql/mutation/preset_view/destroy.rb +1 -1
- data/lib/ecoportal/api/graphql/mutation/preset_view/permission.rb +37 -37
- data/lib/ecoportal/api/graphql/mutation/preset_view/update.rb +35 -35
- data/lib/ecoportal/api/graphql/mutation/preset_view.rb +15 -15
- data/lib/ecoportal/api/graphql/mutation/register/create.rb +35 -35
- data/lib/ecoportal/api/graphql/mutation/register/destroy.rb +1 -1
- data/lib/ecoportal/api/graphql/mutation/register/update.rb +35 -35
- data/lib/ecoportal/api/graphql/mutation/register.rb +14 -14
- data/lib/ecoportal/api/graphql/payload/action/archive.rb +13 -13
- data/lib/ecoportal/api/graphql/payload/action/create.rb +13 -13
- data/lib/ecoportal/api/graphql/payload/action/update.rb +13 -13
- data/lib/ecoportal/api/graphql/payload/action.rb +14 -14
- data/lib/ecoportal/api/graphql/payload/ai_summary_generate.rb +12 -12
- data/lib/ecoportal/api/graphql/payload/contractor_entity/create.rb +13 -13
- data/lib/ecoportal/api/graphql/payload/contractor_entity/destroy.rb +12 -12
- data/lib/ecoportal/api/graphql/payload/contractor_entity/update.rb +12 -12
- data/lib/ecoportal/api/graphql/payload/kickstand/bulk_update_jobs.rb +2 -2
- data/lib/ecoportal/api/graphql/payload/kickstand/bulk_update_workflows.rb +2 -2
- data/lib/ecoportal/api/graphql/payload/location_structure/apply_commands.rb +51 -51
- data/lib/ecoportal/api/graphql/payload/location_structure/command_execution_result.rb +50 -50
- data/lib/ecoportal/api/graphql/payload/location_structure/draft/add_commands.rb +30 -30
- data/lib/ecoportal/api/graphql/payload/location_structure/draft/delete.rb +30 -30
- data/lib/ecoportal/api/graphql/payload/location_structure/draft/drop_bad_commands.rb +43 -43
- data/lib/ecoportal/api/graphql/payload/location_structure/draft/publish.rb +63 -63
- data/lib/ecoportal/api/graphql/payload/location_structure/draft.rb +18 -18
- data/lib/ecoportal/api/graphql/payload/location_structure.rb +14 -14
- data/lib/ecoportal/api/graphql/payload/ok_payload.rb +1 -1
- data/lib/ecoportal/api/graphql/payload/page/archive.rb +13 -13
- data/lib/ecoportal/api/graphql/payload/page/build_from_template.rb +13 -13
- data/lib/ecoportal/api/graphql/payload/page/create_from_template.rb +13 -13
- data/lib/ecoportal/api/graphql/payload/page/draft.rb +1 -1
- data/lib/ecoportal/api/graphql/payload/page/review_task.rb +1 -1
- data/lib/ecoportal/api/graphql/payload/page/unarchive.rb +13 -13
- data/lib/ecoportal/api/graphql/payload/page/update.rb +13 -13
- data/lib/ecoportal/api/graphql/payload/preset_view.rb +1 -1
- data/lib/ecoportal/api/graphql/payload/register.rb +1 -1
- data/lib/ecoportal/api/graphql/query/action.rb +33 -33
- data/lib/ecoportal/api/graphql/query/action_categories.rb +53 -53
- data/lib/ecoportal/api/graphql/query/actions.rb +43 -43
- data/lib/ecoportal/api/graphql/query/contractor_entities.rb +53 -53
- data/lib/ecoportal/api/graphql/query/file_upload_signature.rb +76 -76
- data/lib/ecoportal/api/graphql/query/location_classifications.rb +39 -39
- data/lib/ecoportal/api/graphql/query/page_delta.rb +47 -47
- data/lib/ecoportal/api/graphql/query/pages.rb +59 -59
- data/lib/ecoportal/api/graphql/query/person_members.rb +76 -0
- data/lib/ecoportal/api/graphql/query/register_preset_views.rb +1 -1
- data/lib/ecoportal/api/graphql/query/register_preview_pages.rb +83 -83
- data/lib/ecoportal/api/graphql/query/template_change_log.rb +118 -0
- data/lib/ecoportal/api/graphql/query/templates.rb +53 -53
- data/lib/ecoportal/api/graphql/query.rb +2 -0
- data/lib/ecoportal/api/graphql_version.rb +1 -1
- data/lib/ecoportal/api-graphql.rb +10 -10
- metadata +10 -8
- data/lib/ecoportal/api/common/graphql/CLAUDE.md +0 -36
- data/lib/ecoportal/api/common/graphql/model/CLAUDE.md +0 -28
- data/lib/ecoportal/api/graphql/CLAUDE.md +0 -37
- data/lib/ecoportal/api/graphql/base/CLAUDE.md +0 -50
- data/lib/ecoportal/api/graphql/builder/CLAUDE.md +0 -65
|
@@ -17,6 +17,8 @@ module Ecoportal
|
|
|
17
17
|
createPublicConfig: 'Ecoportal::API::GraphQL::Input::WorkflowCommand::CreatePublicConfig',
|
|
18
18
|
editPublicConfig: 'Ecoportal::API::GraphQL::Input::WorkflowCommand::EditPublicConfig',
|
|
19
19
|
archivePublicConfig: 'Ecoportal::API::GraphQL::Input::WorkflowCommand::ArchivePublicConfig',
|
|
20
|
+
# Copy-page configuration (20260819)
|
|
21
|
+
manageCopyPageConfiguration: 'Ecoportal::API::GraphQL::Input::WorkflowCommand::ManageCopyPageConfiguration',
|
|
20
22
|
# Stage structural
|
|
21
23
|
addStage: 'Ecoportal::API::GraphQL::Input::WorkflowCommand::AddStage',
|
|
22
24
|
removeStage: 'Ecoportal::API::GraphQL::Input::WorkflowCommand::RemoveStage',
|
|
@@ -176,6 +178,7 @@ require_relative 'workflow_command/edit_template_container_uid'
|
|
|
176
178
|
require_relative 'workflow_command/create_public_config'
|
|
177
179
|
require_relative 'workflow_command/edit_public_config'
|
|
178
180
|
require_relative 'workflow_command/archive_public_config'
|
|
181
|
+
require_relative 'workflow_command/manage_copy_page_configuration'
|
|
179
182
|
require_relative 'workflow_command/add_checklist_field_item'
|
|
180
183
|
require_relative 'workflow_command/edit_checklist_field_item'
|
|
181
184
|
require_relative 'workflow_command/remove_checklist_field_item'
|
|
@@ -37,6 +37,20 @@ module Ecoportal
|
|
|
37
37
|
Array(doc['locations']).map { |l| l.is_a?(Hash) ? l['id'] : l }.compact
|
|
38
38
|
end
|
|
39
39
|
|
|
40
|
+
# Compiled tag set (client-side build of the backend-only "compiled_tags").
|
|
41
|
+
# This base implementation covers a non-phased page (and is the fallback for a
|
|
42
|
+
# phased page with no stages): there are no per-stage tags, so the set is just the
|
|
43
|
+
# page-level components, de-duplicated:
|
|
44
|
+
#
|
|
45
|
+
# all_tags = Unique(baseTags + otherTags + location_ids)
|
|
46
|
+
#
|
|
47
|
+
# Model::Page::Phased overrides this to take the union across its stages' #all_tags.
|
|
48
|
+
# Returns a de-duplicated Array of tag strings.
|
|
49
|
+
def all_tags
|
|
50
|
+
(Array(baseTags) + Array(otherTags) + Array(location_ids)).
|
|
51
|
+
compact.uniq
|
|
52
|
+
end
|
|
53
|
+
|
|
40
54
|
def location_ids=(ids)
|
|
41
55
|
doc['locations'] = Array(ids).map { |id_val| { 'id' => id_val } }
|
|
42
56
|
end
|
|
@@ -1,43 +1,43 @@
|
|
|
1
|
-
module Ecoportal
|
|
2
|
-
module API
|
|
3
|
-
class GraphQL
|
|
4
|
-
module Interface
|
|
5
|
-
module LocationStructure
|
|
6
|
-
class Node < Logic::BaseModel
|
|
7
|
-
root!
|
|
8
|
-
|
|
9
|
-
class_resolver :location_classification_class, 'Ecoportal::API::GraphQL::Base::LocationClassificationType'
|
|
10
|
-
class_resolver :location_node_class, self
|
|
11
|
-
|
|
12
|
-
passkey :id
|
|
13
|
-
passthrough :name
|
|
14
|
-
embeds_many :classifications, klass: :location_classification_class
|
|
15
|
-
passarray :classificationObjectIds
|
|
16
|
-
|
|
17
|
-
passthrough :weight
|
|
18
|
-
|
|
19
|
-
passboolean :archived
|
|
20
|
-
passthrough :archivedToken
|
|
21
|
-
|
|
22
|
-
passthrough :structureId
|
|
23
|
-
|
|
24
|
-
embeds_one :parent, klass: :location_node_class, nullable: true
|
|
25
|
-
passthrough :parentObjectId
|
|
26
|
-
|
|
27
|
-
def parentId
|
|
28
|
-
parent&.id
|
|
29
|
-
end
|
|
30
|
-
alias_method :parent_id, :parentId
|
|
31
|
-
|
|
32
|
-
def parent_id_upcase
|
|
33
|
-
parent_id&.upcase
|
|
34
|
-
end
|
|
35
|
-
|
|
36
|
-
embeds_many :ancestors, klass: :location_node_class, read_only: true
|
|
37
|
-
embeds_many :children, klass: :location_node_class, read_only: true
|
|
38
|
-
end
|
|
39
|
-
end
|
|
40
|
-
end
|
|
41
|
-
end
|
|
42
|
-
end
|
|
43
|
-
end
|
|
1
|
+
module Ecoportal
|
|
2
|
+
module API
|
|
3
|
+
class GraphQL
|
|
4
|
+
module Interface
|
|
5
|
+
module LocationStructure
|
|
6
|
+
class Node < Logic::BaseModel
|
|
7
|
+
root!
|
|
8
|
+
|
|
9
|
+
class_resolver :location_classification_class, 'Ecoportal::API::GraphQL::Base::LocationClassificationType'
|
|
10
|
+
class_resolver :location_node_class, self
|
|
11
|
+
|
|
12
|
+
passkey :id
|
|
13
|
+
passthrough :name
|
|
14
|
+
embeds_many :classifications, klass: :location_classification_class
|
|
15
|
+
passarray :classificationObjectIds
|
|
16
|
+
|
|
17
|
+
passthrough :weight
|
|
18
|
+
|
|
19
|
+
passboolean :archived
|
|
20
|
+
passthrough :archivedToken
|
|
21
|
+
|
|
22
|
+
passthrough :structureId
|
|
23
|
+
|
|
24
|
+
embeds_one :parent, klass: :location_node_class, nullable: true
|
|
25
|
+
passthrough :parentObjectId
|
|
26
|
+
|
|
27
|
+
def parentId
|
|
28
|
+
parent&.id
|
|
29
|
+
end
|
|
30
|
+
alias_method :parent_id, :parentId
|
|
31
|
+
|
|
32
|
+
def parent_id_upcase
|
|
33
|
+
parent_id&.upcase
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
embeds_many :ancestors, klass: :location_node_class, read_only: true
|
|
37
|
+
embeds_many :children, klass: :location_node_class, read_only: true
|
|
38
|
+
end
|
|
39
|
+
end
|
|
40
|
+
end
|
|
41
|
+
end
|
|
42
|
+
end
|
|
43
|
+
end
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
module Ecoportal
|
|
2
|
-
module API
|
|
3
|
-
class GraphQL
|
|
4
|
-
module Interface
|
|
5
|
-
module LocationStructure
|
|
6
|
-
end
|
|
7
|
-
end
|
|
8
|
-
end
|
|
9
|
-
end
|
|
10
|
-
end
|
|
11
|
-
|
|
12
|
-
require_relative 'location_structure/node'
|
|
13
|
-
require_relative 'location_structure/nodes'
|
|
14
|
-
require_relative 'location_structure/command'
|
|
1
|
+
module Ecoportal
|
|
2
|
+
module API
|
|
3
|
+
class GraphQL
|
|
4
|
+
module Interface
|
|
5
|
+
module LocationStructure
|
|
6
|
+
end
|
|
7
|
+
end
|
|
8
|
+
end
|
|
9
|
+
end
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
require_relative 'location_structure/node'
|
|
13
|
+
require_relative 'location_structure/nodes'
|
|
14
|
+
require_relative 'location_structure/command'
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
module Ecoportal
|
|
2
|
-
module API
|
|
3
|
-
class GraphQL
|
|
4
|
-
module Interface
|
|
5
|
-
end
|
|
6
|
-
end
|
|
7
|
-
end
|
|
8
|
-
end
|
|
9
|
-
|
|
10
|
-
require_relative 'interface/location_structure'
|
|
11
|
-
require_relative 'interface/base_page'
|
|
1
|
+
module Ecoportal
|
|
2
|
+
module API
|
|
3
|
+
class GraphQL
|
|
4
|
+
module Interface
|
|
5
|
+
end
|
|
6
|
+
end
|
|
7
|
+
end
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
require_relative 'interface/location_structure'
|
|
11
|
+
require_relative 'interface/base_page'
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
module Ecoportal
|
|
2
|
-
module API
|
|
3
|
-
class GraphQL
|
|
4
|
-
module Logic
|
|
5
|
-
class BaseModel < Ecoportal::API::Common::GraphQL::Model
|
|
6
|
-
include Ecoportal::API::GraphQL::Concerns::SnakeCamelAccess
|
|
7
|
-
|
|
8
|
-
class << self
|
|
9
|
-
attr_accessor :client
|
|
10
|
-
end
|
|
11
|
-
end
|
|
12
|
-
end
|
|
13
|
-
end
|
|
14
|
-
end
|
|
15
|
-
end
|
|
1
|
+
module Ecoportal
|
|
2
|
+
module API
|
|
3
|
+
class GraphQL
|
|
4
|
+
module Logic
|
|
5
|
+
class BaseModel < Ecoportal::API::Common::GraphQL::Model
|
|
6
|
+
include Ecoportal::API::GraphQL::Concerns::SnakeCamelAccess
|
|
7
|
+
|
|
8
|
+
class << self
|
|
9
|
+
attr_accessor :client
|
|
10
|
+
end
|
|
11
|
+
end
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
end
|
|
@@ -1,193 +1,260 @@
|
|
|
1
|
-
module Ecoportal
|
|
2
|
-
module API
|
|
3
|
-
class GraphQL
|
|
4
|
-
module Logic
|
|
5
|
-
class BaseQuery
|
|
6
|
-
include Ecoportal::API::Common::GraphQL::ClassHelpers
|
|
7
|
-
|
|
8
|
-
inheritable_attrs :accepted_params, :param_defaults
|
|
9
|
-
|
|
10
|
-
DETAIL_ERRORS = [
|
|
11
|
-
Ecoportal::API::Common::GraphQL::ResponseError,
|
|
12
|
-
Ecoportal::API::Common::Client::Error::UnexpectedServerError,
|
|
13
|
-
Faraday::ParsingError,
|
|
14
|
-
Graphlient::Errors::FaradayServerError,
|
|
15
|
-
Graphlient::Errors::GraphQLError,
|
|
16
|
-
Graphlient::Errors::ClientError
|
|
17
|
-
].freeze
|
|
18
|
-
|
|
19
|
-
class << self
|
|
20
|
-
def param_defaults
|
|
21
|
-
@param_defaults ||= {}
|
|
22
|
-
end
|
|
23
|
-
|
|
24
|
-
def accepted_params(*keys, default: :unused)
|
|
25
|
-
@accepted_params ||= []
|
|
26
|
-
return @accepted_params if keys.empty?
|
|
27
|
-
|
|
28
|
-
keys.map(&:to_sym).uniq.each do |key|
|
|
29
|
-
@accepted_params |= [key]
|
|
30
|
-
param_defaults[key] = default unless default == :unused
|
|
31
|
-
end
|
|
32
|
-
|
|
33
|
-
@accepted_params.push(*keys).tap(&:uniq!)
|
|
34
|
-
@accepted_params
|
|
35
|
-
end
|
|
36
|
-
|
|
37
|
-
def clear_accepted_params
|
|
38
|
-
@param_defaults = {}
|
|
39
|
-
@accepted_params = []
|
|
40
|
-
end
|
|
41
|
-
|
|
42
|
-
def slice_params(kargs)
|
|
43
|
-
kargs.slice(*accepted_params)
|
|
44
|
-
end
|
|
45
|
-
|
|
46
|
-
# Used to obtain the full `path` in the GraphQL query by using `base_path`
|
|
47
|
-
# @note it is meant for reusability of queries from different end-points
|
|
48
|
-
def field_name(str = nil)
|
|
49
|
-
return @field_name unless str
|
|
50
|
-
|
|
51
|
-
@field_name = nil
|
|
52
|
-
@field_name = str.to_s if str
|
|
53
|
-
@field_name
|
|
54
|
-
end
|
|
55
|
-
|
|
56
|
-
def base_path(path = :unused)
|
|
57
|
-
return @base_path if path == :unused
|
|
58
|
-
|
|
59
|
-
path ||= []
|
|
60
|
-
path = path.to_s.split('.') if path.is_a?(String)
|
|
61
|
-
path = path.map(&:to_s).compact
|
|
62
|
-
|
|
63
|
-
@base_path = path
|
|
64
|
-
end
|
|
65
|
-
end
|
|
66
|
-
|
|
67
|
-
include Ecoportal::API::Common::Concerns::Benchmarkable
|
|
68
|
-
|
|
69
|
-
attr_reader :client, :base_path
|
|
70
|
-
|
|
71
|
-
def initialize(client, path: nil, base_path: self.class.base_path)
|
|
72
|
-
@path = path
|
|
73
|
-
@base_path = base_path
|
|
74
|
-
@client = client
|
|
75
|
-
end
|
|
76
|
-
|
|
77
|
-
# Resolves the `path` by using `path` or `base_path` + `class.field_name`.
|
|
78
|
-
def path(field_name = self.class.field_name)
|
|
79
|
-
result = @path
|
|
80
|
-
result ||= default_path if respond_to?(:default_path, true)
|
|
81
|
-
result ||= (base_path + [field_name]) if base_path && field_name
|
|
82
|
-
result ||= [field_name]
|
|
83
|
-
result
|
|
84
|
-
end
|
|
85
|
-
|
|
86
|
-
# Query rely that manages the different blocks.
|
|
87
|
-
# @return [Class] an object of `response_class` with the results hanging from `path`.
|
|
88
|
-
def query(path: self.path, raw_response: {}, **kargs, &block)
|
|
89
|
-
print = !is_a?(Mutation)
|
|
90
|
-
|
|
91
|
-
benchmarking("#{self.class}##{__method__}", print: print) do
|
|
92
|
-
graphql_query(
|
|
93
|
-
path: path,
|
|
94
|
-
raw_response: raw_response,
|
|
95
|
-
**kargs,
|
|
96
|
-
&basic_block(&block)
|
|
97
|
-
)
|
|
98
|
-
end
|
|
99
|
-
end
|
|
100
|
-
|
|
101
|
-
def response_class
|
|
102
|
-
raise "You should override this method in #{self.class}"
|
|
103
|
-
end
|
|
104
|
-
|
|
105
|
-
def access_point(path = [])
|
|
106
|
-
path.last
|
|
107
|
-
end
|
|
108
|
-
|
|
109
|
-
private
|
|
110
|
-
|
|
111
|
-
def basic_block
|
|
112
|
-
raise "This method should be implemented in the child class #{self.class}"
|
|
113
|
-
end
|
|
114
|
-
|
|
115
|
-
# Types that should be passed through as-is as GraphQL variable values.
|
|
116
|
-
# Anything else that responds to to_h is treated as a serialisable value object.
|
|
117
|
-
VARIABLE_PRIMITIVES = [
|
|
118
|
-
::NilClass, ::TrueClass, ::FalseClass,
|
|
119
|
-
::Integer, ::Float, ::String, ::Symbol,
|
|
120
|
-
::Hash, ::Array
|
|
121
|
-
].freeze
|
|
122
|
-
private_constant :VARIABLE_PRIMITIVES
|
|
123
|
-
|
|
124
|
-
def normalize_variables(kargs)
|
|
125
|
-
kargs.transform_values do |v|
|
|
126
|
-
VARIABLE_PRIMITIVES.any? { |t| v.is_a?(t) } || !v.respond_to?(:to_h) ? v : v.to_h
|
|
127
|
-
end
|
|
128
|
-
end
|
|
129
|
-
|
|
130
|
-
def graphql_query(path: self.path, raw_response: {}, **kargs, &block)
|
|
131
|
-
default_params = self.class.param_defaults.dup
|
|
132
|
-
query_params = self.class.slice_params(normalize_variables(default_params.merge(kargs)))
|
|
133
|
-
|
|
134
|
-
query_str = client.to_query_string(&block)
|
|
135
|
-
fragment_str = assemble_fragments(query_str)
|
|
136
|
-
full_query = fragment_str.empty? ? query_str : "#{query_str}\n\n#{fragment_str}"
|
|
137
|
-
|
|
138
|
-
request(*path) do
|
|
139
|
-
client.http_client.execute(full_query, variables: query_params).tap do |response|
|
|
140
|
-
raw_response[:data] = response
|
|
141
|
-
end
|
|
142
|
-
end
|
|
143
|
-
rescue *DETAIL_ERRORS =>
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
#
|
|
157
|
-
#
|
|
158
|
-
#
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
def
|
|
179
|
-
|
|
180
|
-
#
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
1
|
+
module Ecoportal
|
|
2
|
+
module API
|
|
3
|
+
class GraphQL
|
|
4
|
+
module Logic
|
|
5
|
+
class BaseQuery
|
|
6
|
+
include Ecoportal::API::Common::GraphQL::ClassHelpers
|
|
7
|
+
|
|
8
|
+
inheritable_attrs :accepted_params, :param_defaults
|
|
9
|
+
|
|
10
|
+
DETAIL_ERRORS = [
|
|
11
|
+
Ecoportal::API::Common::GraphQL::ResponseError,
|
|
12
|
+
Ecoportal::API::Common::Client::Error::UnexpectedServerError,
|
|
13
|
+
Faraday::ParsingError,
|
|
14
|
+
Graphlient::Errors::FaradayServerError,
|
|
15
|
+
Graphlient::Errors::GraphQLError,
|
|
16
|
+
Graphlient::Errors::ClientError
|
|
17
|
+
].freeze
|
|
18
|
+
|
|
19
|
+
class << self
|
|
20
|
+
def param_defaults
|
|
21
|
+
@param_defaults ||= {}
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
def accepted_params(*keys, default: :unused)
|
|
25
|
+
@accepted_params ||= []
|
|
26
|
+
return @accepted_params if keys.empty?
|
|
27
|
+
|
|
28
|
+
keys.map(&:to_sym).uniq.each do |key|
|
|
29
|
+
@accepted_params |= [key]
|
|
30
|
+
param_defaults[key] = default unless default == :unused
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
@accepted_params.push(*keys).tap(&:uniq!)
|
|
34
|
+
@accepted_params
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
def clear_accepted_params
|
|
38
|
+
@param_defaults = {}
|
|
39
|
+
@accepted_params = []
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
def slice_params(kargs)
|
|
43
|
+
kargs.slice(*accepted_params)
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
# Used to obtain the full `path` in the GraphQL query by using `base_path`
|
|
47
|
+
# @note it is meant for reusability of queries from different end-points
|
|
48
|
+
def field_name(str = nil)
|
|
49
|
+
return @field_name unless str
|
|
50
|
+
|
|
51
|
+
@field_name = nil
|
|
52
|
+
@field_name = str.to_s if str
|
|
53
|
+
@field_name
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
def base_path(path = :unused)
|
|
57
|
+
return @base_path if path == :unused
|
|
58
|
+
|
|
59
|
+
path ||= []
|
|
60
|
+
path = path.to_s.split('.') if path.is_a?(String)
|
|
61
|
+
path = path.map(&:to_s).compact
|
|
62
|
+
|
|
63
|
+
@base_path = path
|
|
64
|
+
end
|
|
65
|
+
end
|
|
66
|
+
|
|
67
|
+
include Ecoportal::API::Common::Concerns::Benchmarkable
|
|
68
|
+
|
|
69
|
+
attr_reader :client, :base_path
|
|
70
|
+
|
|
71
|
+
def initialize(client, path: nil, base_path: self.class.base_path)
|
|
72
|
+
@path = path
|
|
73
|
+
@base_path = base_path
|
|
74
|
+
@client = client
|
|
75
|
+
end
|
|
76
|
+
|
|
77
|
+
# Resolves the `path` by using `path` or `base_path` + `class.field_name`.
|
|
78
|
+
def path(field_name = self.class.field_name)
|
|
79
|
+
result = @path
|
|
80
|
+
result ||= default_path if respond_to?(:default_path, true)
|
|
81
|
+
result ||= (base_path + [field_name]) if base_path && field_name
|
|
82
|
+
result ||= [field_name]
|
|
83
|
+
result
|
|
84
|
+
end
|
|
85
|
+
|
|
86
|
+
# Query rely that manages the different blocks.
|
|
87
|
+
# @return [Class] an object of `response_class` with the results hanging from `path`.
|
|
88
|
+
def query(path: self.path, raw_response: {}, **kargs, &block)
|
|
89
|
+
print = !is_a?(Mutation)
|
|
90
|
+
|
|
91
|
+
benchmarking("#{self.class}##{__method__}", print: print) do
|
|
92
|
+
graphql_query(
|
|
93
|
+
path: path,
|
|
94
|
+
raw_response: raw_response,
|
|
95
|
+
**kargs,
|
|
96
|
+
&basic_block(&block)
|
|
97
|
+
)
|
|
98
|
+
end
|
|
99
|
+
end
|
|
100
|
+
|
|
101
|
+
def response_class
|
|
102
|
+
raise "You should override this method in #{self.class}"
|
|
103
|
+
end
|
|
104
|
+
|
|
105
|
+
def access_point(path = [])
|
|
106
|
+
path.last
|
|
107
|
+
end
|
|
108
|
+
|
|
109
|
+
private
|
|
110
|
+
|
|
111
|
+
def basic_block
|
|
112
|
+
raise "This method should be implemented in the child class #{self.class}"
|
|
113
|
+
end
|
|
114
|
+
|
|
115
|
+
# Types that should be passed through as-is as GraphQL variable values.
|
|
116
|
+
# Anything else that responds to to_h is treated as a serialisable value object.
|
|
117
|
+
VARIABLE_PRIMITIVES = [
|
|
118
|
+
::NilClass, ::TrueClass, ::FalseClass,
|
|
119
|
+
::Integer, ::Float, ::String, ::Symbol,
|
|
120
|
+
::Hash, ::Array
|
|
121
|
+
].freeze
|
|
122
|
+
private_constant :VARIABLE_PRIMITIVES
|
|
123
|
+
|
|
124
|
+
def normalize_variables(kargs)
|
|
125
|
+
kargs.transform_values do |v|
|
|
126
|
+
VARIABLE_PRIMITIVES.any? { |t| v.is_a?(t) } || !v.respond_to?(:to_h) ? v : v.to_h
|
|
127
|
+
end
|
|
128
|
+
end
|
|
129
|
+
|
|
130
|
+
def graphql_query(path: self.path, raw_response: {}, **kargs, &block)
|
|
131
|
+
default_params = self.class.param_defaults.dup
|
|
132
|
+
query_params = self.class.slice_params(normalize_variables(default_params.merge(kargs)))
|
|
133
|
+
|
|
134
|
+
query_str = client.to_query_string(&block)
|
|
135
|
+
fragment_str = assemble_fragments(query_str)
|
|
136
|
+
full_query = fragment_str.empty? ? query_str : "#{query_str}\n\n#{fragment_str}"
|
|
137
|
+
|
|
138
|
+
request(*path) do
|
|
139
|
+
client.http_client.execute(full_query, variables: query_params).tap do |response|
|
|
140
|
+
raw_response[:data] = response
|
|
141
|
+
end
|
|
142
|
+
end
|
|
143
|
+
rescue *DETAIL_ERRORS => err
|
|
144
|
+
report_query_failure(err, query_params)
|
|
145
|
+
raise
|
|
146
|
+
end
|
|
147
|
+
|
|
148
|
+
# Reports WHERE a query failed, on stderr, and re-raises untouched.
|
|
149
|
+
#
|
|
150
|
+
# ★ This replaces an unconditional `pp kargs` / `pp query_params` / `pp block`
|
|
151
|
+
# to STDOUT. That dump was NOT debug litter — it existed because graphlient
|
|
152
|
+
# masks the origin of a failure: `Client#parse`/`#execute` do
|
|
153
|
+
# `raise Graphlient::Errors::ClientError, e.message`, which leaves graphlient's
|
|
154
|
+
# own `inner_exception` nil AND replaces the backtrace, discarding the source
|
|
155
|
+
# location `graphql-client` deliberately sets via
|
|
156
|
+
# `set_backtrace(["#{filename}:#{line}"])`. With that gone there was no other
|
|
157
|
+
# way to see which query blew up. (Tracked upstream; see
|
|
158
|
+
# `.ai-assistance/code/refactoring/opportunities.md`.)
|
|
159
|
+
#
|
|
160
|
+
# But the location was never actually destroyed. Ruby populates `.cause`
|
|
161
|
+
# automatically when you raise inside a rescue, so the original error — with the
|
|
162
|
+
# location intact — is one hop away. Verified by execution:
|
|
163
|
+
#
|
|
164
|
+
# err.inner_exception => nil (graphlient's api, broken)
|
|
165
|
+
# err.backtrace.first => ".../client.rb:20" (the raise site, useless)
|
|
166
|
+
# err.cause.backtrace.first => "app/queries/x.rb:198" (the QUERY site)
|
|
167
|
+
#
|
|
168
|
+
# So this reports MORE of what the dump was for (the failing query's own source
|
|
169
|
+
# location) and LESS of what it should never have emitted: `query_params` holds
|
|
170
|
+
# GraphQL variables — page ids, emails, field values — and printing them to
|
|
171
|
+
# stdout put customer data into CI logs. Variables are now shown only when the
|
|
172
|
+
# client's existing `deep_logging` flag is on (see `dump_variables?` for why NOT
|
|
173
|
+
# the logger level). `pp block` is dropped outright: inspecting a Proc never
|
|
174
|
+
# identified anything.
|
|
175
|
+
#
|
|
176
|
+
# Emitted with `warn` (stderr, and suppressible via the Warning module) rather than
|
|
177
|
+
# `puts`, so tools that pipe query results keep a clean stdout. Tracked as Q-43.
|
|
178
|
+
def report_query_failure(err, query_params = nil)
|
|
179
|
+
origin = err.cause
|
|
180
|
+
lines = ["[#{self.class.name || self.class}] #{err.class}: #{failure_message(err)}"]
|
|
181
|
+
lines << " origin: #{origin.class}" if origin
|
|
182
|
+
lines << " at: #{origin.backtrace.first}" if origin&.backtrace&.first
|
|
183
|
+
lines << " params: #{query_params.inspect}" if dump_variables?
|
|
184
|
+
|
|
185
|
+
warn(lines.join("\n"))
|
|
186
|
+
end
|
|
187
|
+
|
|
188
|
+
# graphlient's `GraphQLError#to_s` / `ExecutionError#to_s` format from
|
|
189
|
+
# `errors.details` and render an EMPTY string when that is empty — and because
|
|
190
|
+
# they override `to_s`, the fallback text their constructors pass to `super` is
|
|
191
|
+
# unreachable. An exception with a blank message is invisible in a log, so say
|
|
192
|
+
# so rather than printing nothing.
|
|
193
|
+
def failure_message(err)
|
|
194
|
+
msg = err.message.to_s
|
|
195
|
+
return msg unless msg.empty?
|
|
196
|
+
|
|
197
|
+
"(blank — #{err.class} renders its message from errors.details, which was empty)"
|
|
198
|
+
end
|
|
199
|
+
|
|
200
|
+
# Opt-in via the client's EXISTING `deep_logging` flag ("whether or not batch
|
|
201
|
+
# responses should be logged") — the same class of thing as dumping variables,
|
|
202
|
+
# and it defaults to false. No new env var and no new config knob.
|
|
203
|
+
#
|
|
204
|
+
# ⚠ Do NOT gate this on `logger.debug?`, which is the obvious-looking choice and
|
|
205
|
+
# is wrong: `HttpClient`'s default logger is `::Logger.new(IO::NULL)`, and a
|
|
206
|
+
# fresh Logger's level is DEBUG (0) — so `logger.debug?` is `true` out of the
|
|
207
|
+
# box and variables would leak by default, which is the whole thing being fixed.
|
|
208
|
+
# A spec pins this.
|
|
209
|
+
def dump_variables?
|
|
210
|
+
http = client&.http_client
|
|
211
|
+
return false unless http.respond_to?(:deep_logging?, true)
|
|
212
|
+
|
|
213
|
+
!!http.send(:deep_logging?)
|
|
214
|
+
rescue StandardError
|
|
215
|
+
false
|
|
216
|
+
end
|
|
217
|
+
|
|
218
|
+
def request(*path)
|
|
219
|
+
response = yield
|
|
220
|
+
wrap_response(response, path)
|
|
221
|
+
end
|
|
222
|
+
|
|
223
|
+
# Resolves all fragment spreads in query_str, recursively following
|
|
224
|
+
# spreads inside assembled fragment bodies until no new names are found.
|
|
225
|
+
# Names that don't resolve to a registered fragment are skipped safely.
|
|
226
|
+
def assemble_fragments(query_str)
|
|
227
|
+
tried = {}
|
|
228
|
+
assembled = {}
|
|
229
|
+
pending = query_str.scan(/\.\.\.(\w+)/).flatten.map(&:to_sym).uniq
|
|
230
|
+
|
|
231
|
+
until (unresolved = pending.reject { |n| tried.key?(n) }).empty?
|
|
232
|
+
unresolved.each do |name|
|
|
233
|
+
tried[name] = true
|
|
234
|
+
frag = Ecoportal::API::GraphQL::Fragment.assemble(name)
|
|
235
|
+
next if frag.empty?
|
|
236
|
+
|
|
237
|
+
assembled[name] = frag
|
|
238
|
+
pending |= frag.scan(/\.\.\.(\w+)/).flatten.map(&:to_sym)
|
|
239
|
+
end
|
|
240
|
+
end
|
|
241
|
+
|
|
242
|
+
assembled.values.join("\n\n")
|
|
243
|
+
end
|
|
244
|
+
|
|
245
|
+
def wrap_response(response, path = [])
|
|
246
|
+
# we use the Hash, because fragments are persmissioned
|
|
247
|
+
# see Use of Fragments at https://github.com/ashkan18/graphlient/tree/master?tab=readme-ov-file#use-of-fragments
|
|
248
|
+
unless (res = response.to_h.dig(*path.dup.unshift('data')))
|
|
249
|
+
msg = "Complete failure on request. Path: #{path}\n#{response.to_h.pretty_inspect}"
|
|
250
|
+
raise msg
|
|
251
|
+
end
|
|
252
|
+
|
|
253
|
+
data = Ecoportal::API::Common::GraphQL::HashHelpers.deep_dup(res)
|
|
254
|
+
response_class.new(data)
|
|
255
|
+
end
|
|
256
|
+
end
|
|
257
|
+
end
|
|
258
|
+
end
|
|
259
|
+
end
|
|
260
|
+
end
|