From cc2b1dc357ad9468e1f34bf5b8290a11c1341b7f Mon Sep 17 00:00:00 2001 From: Bracey Summers <35816572+bsummers-tc@users.noreply.github.com> Date: Thu, 31 Aug 2023 14:13:46 -0500 Subject: [PATCH] Updates for version 4.0.1 (#317) - APP-4055 - [API] Updated v3 gen body to allow 0 and false in body - APP-4056 - [API] Updated Transforms to Support Email Group Type - APP-4057 - [Logging] Added lock to sensitive filter to fix concurrent update exception - APP-4075 - [APP] Added support for System App type - APP-4107 - [Config] Updated config submodule (tcex.json model) to support legacy App Builder Apps - APP-4108 - [API] Removed max_length and min_length from TI models --- pyproject.toml | 2 +- release_notes.md | 9 ++++++--- tcex/api/tc/v3/_gen/_gen_model_abc.py | 8 ++++---- tcex/api/tc/v3/artifacts/artifact_model.py | 6 ------ .../tc/v3/case_attributes/case_attribute_model.py | 1 - tcex/api/tc/v3/cases/case_model.py | 6 ------ .../tc/v3/group_attributes/group_attribute_model.py | 1 - tcex/api/tc/v3/groups/group_model.py | 13 ------------- .../indicator_attribute_model.py | 1 - tcex/api/tc/v3/indicators/indicator_model.py | 1 - tcex/api/tc/v3/notes/note_model.py | 2 -- .../tc/v3/security_labels/security_label_model.py | 6 ------ tcex/api/tc/v3/tags/tag_model.py | 4 ---- tcex/api/tc/v3/tasks/task_model.py | 6 ------ tcex/api/tc/v3/victim_assets/victim_asset_model.py | 9 --------- .../v3/victim_attributes/victim_attribute_model.py | 1 - tcex/api/tc/v3/victims/victim_model.py | 12 ------------ .../tc/v3/workflow_events/workflow_event_model.py | 4 ---- .../workflow_templates/workflow_template_model.py | 4 ---- tcex/app/config | 2 +- tcex/app/key_value_store | 2 +- tcex/app/playbook | 2 +- tcex/input/model/app_system_model.py | 9 +++++++++ tcex/input/model/model_map.py | 3 ++- tcex/util | 2 +- tests/api/tc/v3/tasks/test_task_interface.py | 2 +- tests/app/config/test_install_json_model.py | 1 + 27 files changed, 28 insertions(+), 91 deletions(-) create mode 100644 tcex/input/model/app_system_model.py diff --git a/pyproject.toml b/pyproject.toml index d14ff2ad2..06284c503 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -29,7 +29,7 @@ dependencies = [ "pydantic<2.0.0", "python-dateutil", "PyYAML", - "redis", + "redis<5.0.0", "requests", "rich", "semantic_version", diff --git a/release_notes.md b/release_notes.md index 6a3e09440..6535f9a26 100644 --- a/release_notes.md +++ b/release_notes.md @@ -3,8 +3,11 @@ ### 4.0.1 - APP-4055 - [API] Updated v3 gen body to allow 0 and false in body -- APP-4056 - [API] Update Transforms to Support Email Group Type -- APP-4057 - [Logging] Add lock to sensitive filter to fix concurrent update exception +- APP-4056 - [API] Updated Transforms to Support Email Group Type +- APP-4057 - [Logging] Added lock to sensitive filter to fix concurrent update exception +- APP-4075 - [APP] Added support for System App type +- APP-4107 - [Config] Updated config submodule (tcex.json model) to support legacy App Builder Apps +- APP-4108 - [API] Removed max_length and min_length from TI models ### 4.0.0 @@ -28,7 +31,7 @@ - APP-3899 - [CLI] Updated error handling on CLI when downloading template files - APP-3900 - [CLI] Updated proxy support for CLI - APP-3906 - [CLI] Don't create requirements.lock file if any errors occurred during tcex deps. - APP-3922 - [API] Update TI Transforms to treat event_date field on some group types as a datetime transform. +- APP-3922 - [API] Update TI Transforms to treat event_date field on some group types as a datetime transform. ### 3.0.7 diff --git a/tcex/api/tc/v3/_gen/_gen_model_abc.py b/tcex/api/tc/v3/_gen/_gen_model_abc.py index e49bb6f8d..20316d26f 100644 --- a/tcex/api/tc/v3/_gen/_gen_model_abc.py +++ b/tcex/api/tc/v3/_gen/_gen_model_abc.py @@ -358,8 +358,8 @@ def gen_model_fields(self) -> str: _model.append(f'''{self.i2}methods={prop.extra.methods},''') # max_length - if prop.max_length is not None: - _model.append(f'''{self.i2}max_length={prop.max_length},''') + # if prop.max_length is not None: + # _model.append(f'''{self.i2}max_length={prop.max_length},''') # max_size # if field_max_size is not None: @@ -370,8 +370,8 @@ def gen_model_fields(self) -> str: _model.append(f'''{self.i2}maximum={prop.max_value},''') # min_length - if prop.min_length is not None: - _model.append(f'''{self.i2}min_length={prop.min_length},''') + # if prop.min_length is not None: + # _model.append(f'''{self.i2}min_length={prop.min_length},''') # min_value if prop.min_value is not None: diff --git a/tcex/api/tc/v3/artifacts/artifact_model.py b/tcex/api/tc/v3/artifacts/artifact_model.py index e5eb12477..11c516ba1 100644 --- a/tcex/api/tc/v3/artifacts/artifact_model.py +++ b/tcex/api/tc/v3/artifacts/artifact_model.py @@ -118,8 +118,6 @@ class ArtifactModel( None, description='The field name for the artifact.', methods=['POST', 'PUT'], - max_length=100, - min_length=0, read_only=False, title='fieldName', ) @@ -175,8 +173,6 @@ class ArtifactModel( None, description='The **source** for the Artifact.', methods=['POST', 'PUT'], - max_length=100, - min_length=0, read_only=False, title='source', ) @@ -184,8 +180,6 @@ class ArtifactModel( None, description='The **summary** for the Artifact.', methods=['POST', 'PUT'], - max_length=500, - min_length=1, read_only=False, title='summary', ) diff --git a/tcex/api/tc/v3/case_attributes/case_attribute_model.py b/tcex/api/tc/v3/case_attributes/case_attribute_model.py index f366c5352..8b1033678 100644 --- a/tcex/api/tc/v3/case_attributes/case_attribute_model.py +++ b/tcex/api/tc/v3/case_attributes/case_attribute_model.py @@ -104,7 +104,6 @@ class CaseAttributeModel( None, description='The attribute value.', methods=['POST', 'PUT'], - min_length=1, read_only=False, title='value', ) diff --git a/tcex/api/tc/v3/cases/case_model.py b/tcex/api/tc/v3/cases/case_model.py index 9c6ef31d2..8bee3ae3b 100644 --- a/tcex/api/tc/v3/cases/case_model.py +++ b/tcex/api/tc/v3/cases/case_model.py @@ -141,8 +141,6 @@ class CaseModel( None, description='The description of the Case.', methods=['POST', 'PUT'], - max_length=1500, - min_length=0, read_only=False, title='description', ) @@ -163,8 +161,6 @@ class CaseModel( None, description='The name of the Case.', methods=['POST', 'PUT'], - max_length=255, - min_length=1, read_only=False, title='name', ) @@ -262,8 +258,6 @@ class CaseModel( None, description='The **xid** for the Case.', methods=['POST'], - max_length=100, - min_length=10, read_only=False, title='xid', ) diff --git a/tcex/api/tc/v3/group_attributes/group_attribute_model.py b/tcex/api/tc/v3/group_attributes/group_attribute_model.py index 4c9552f76..5b47d12e8 100644 --- a/tcex/api/tc/v3/group_attributes/group_attribute_model.py +++ b/tcex/api/tc/v3/group_attributes/group_attribute_model.py @@ -111,7 +111,6 @@ class GroupAttributeModel( None, description='The attribute value.', methods=['POST', 'PUT'], - min_length=1, read_only=False, title='value', ) diff --git a/tcex/api/tc/v3/groups/group_model.py b/tcex/api/tc/v3/groups/group_model.py index 74b35f272..45dba0086 100644 --- a/tcex/api/tc/v3/groups/group_model.py +++ b/tcex/api/tc/v3/groups/group_model.py @@ -81,8 +81,6 @@ class GroupModel( applies_to=['Email'], description='The email Body.', methods=['POST', 'PUT'], - max_length=65535, - min_length=0, read_only=False, title='body', ) @@ -169,8 +167,6 @@ class GroupModel( conditional_required=['Document', 'Report', 'Signature'], description='The document or signature file name.', methods=['POST', 'PUT'], - max_length=255, - min_length=0, read_only=False, title='fileName', ) @@ -212,8 +208,6 @@ class GroupModel( applies_to=['Email'], description='The email From field.', methods=['POST', 'PUT'], - max_length=100, - min_length=0, read_only=False, title='from', ) @@ -229,8 +223,6 @@ class GroupModel( applies_to=['Email'], description='The email Header field.', methods=['POST', 'PUT'], - max_length=65535, - min_length=0, read_only=False, title='header', ) @@ -266,8 +258,6 @@ class GroupModel( None, description='The name of the group.', methods=['POST', 'PUT'], - max_length=100, - min_length=0, read_only=False, title='name', ) @@ -383,8 +373,6 @@ class GroupModel( applies_to=['Email'], description='The email Subject section.', methods=['POST', 'PUT'], - max_length=255, - min_length=0, read_only=False, title='subject', ) @@ -410,7 +398,6 @@ class GroupModel( None, description='The **type** for the Group.', methods=['POST', 'PUT'], - min_length=1, read_only=False, title='type', ) diff --git a/tcex/api/tc/v3/indicator_attributes/indicator_attribute_model.py b/tcex/api/tc/v3/indicator_attributes/indicator_attribute_model.py index c7443c5f1..74b06b3e6 100644 --- a/tcex/api/tc/v3/indicator_attributes/indicator_attribute_model.py +++ b/tcex/api/tc/v3/indicator_attributes/indicator_attribute_model.py @@ -111,7 +111,6 @@ class IndicatorAttributeModel( None, description='The attribute value.', methods=['POST', 'PUT'], - min_length=1, read_only=False, title='value', ) diff --git a/tcex/api/tc/v3/indicators/indicator_model.py b/tcex/api/tc/v3/indicators/indicator_model.py index 1adf8e3ba..b09cc9c69 100644 --- a/tcex/api/tc/v3/indicators/indicator_model.py +++ b/tcex/api/tc/v3/indicators/indicator_model.py @@ -399,7 +399,6 @@ class IndicatorModel( None, description='The **type** for the Indicator.', methods=['POST', 'PUT'], - min_length=1, read_only=False, title='type', ) diff --git a/tcex/api/tc/v3/notes/note_model.py b/tcex/api/tc/v3/notes/note_model.py index 32c97433f..957616ca1 100644 --- a/tcex/api/tc/v3/notes/note_model.py +++ b/tcex/api/tc/v3/notes/note_model.py @@ -128,8 +128,6 @@ class NoteModel( None, description='The **text** for the Note.', methods=['POST', 'PUT'], - max_length=65500, - min_length=1, read_only=False, title='text', ) diff --git a/tcex/api/tc/v3/security_labels/security_label_model.py b/tcex/api/tc/v3/security_labels/security_label_model.py index 53bb04eef..fdaaff87b 100644 --- a/tcex/api/tc/v3/security_labels/security_label_model.py +++ b/tcex/api/tc/v3/security_labels/security_label_model.py @@ -29,8 +29,6 @@ class SecurityLabelModel( None, description='Color of the security label.', methods=['POST', 'PUT'], - max_length=10, - min_length=1, read_only=False, title='color', ) @@ -45,8 +43,6 @@ class SecurityLabelModel( None, description='Description of the security label.', methods=['POST', 'PUT'], - max_length=400, - min_length=1, read_only=False, title='description', ) @@ -60,8 +56,6 @@ class SecurityLabelModel( None, description='Name of the security label.', methods=['POST', 'PUT'], - max_length=50, - min_length=1, read_only=False, title='name', ) diff --git a/tcex/api/tc/v3/tags/tag_model.py b/tcex/api/tc/v3/tags/tag_model.py index c3aae5a64..d23edaee4 100644 --- a/tcex/api/tc/v3/tags/tag_model.py +++ b/tcex/api/tc/v3/tags/tag_model.py @@ -36,8 +36,6 @@ class TagModel( None, description='A brief description of the Tag.', methods=['POST', 'PUT'], - max_length=4000, - min_length=0, read_only=False, title='description', ) @@ -72,8 +70,6 @@ class TagModel( None, description='The **name** for the Tag.', methods=['POST', 'PUT'], - max_length=128, - min_length=1, read_only=False, title='name', ) diff --git a/tcex/api/tc/v3/tasks/task_model.py b/tcex/api/tc/v3/tasks/task_model.py index bbf3989d3..8eca69710 100644 --- a/tcex/api/tc/v3/tasks/task_model.py +++ b/tcex/api/tc/v3/tasks/task_model.py @@ -94,8 +94,6 @@ class TaskModel( None, description='The **description** for the Task.', methods=['POST', 'PUT'], - max_length=1500, - min_length=0, read_only=False, title='description', ) @@ -130,8 +128,6 @@ class TaskModel( None, description='The **name** for the Task.', methods=['POST', 'PUT'], - max_length=255, - min_length=1, read_only=False, title='name', ) @@ -192,8 +188,6 @@ class TaskModel( None, description='The **xid** for the Task.', methods=['POST'], - max_length=100, - min_length=10, read_only=False, title='xid', ) diff --git a/tcex/api/tc/v3/victim_assets/victim_asset_model.py b/tcex/api/tc/v3/victim_assets/victim_asset_model.py index fe6e5ccb6..f5d1e07d9 100644 --- a/tcex/api/tc/v3/victim_assets/victim_asset_model.py +++ b/tcex/api/tc/v3/victim_assets/victim_asset_model.py @@ -28,8 +28,6 @@ class VictimAssetModel( conditional_required=['SocialNetwork', 'NetworkAccount'], description='The network name.', methods=['POST', 'PUT'], - max_length=255, - min_length=1, read_only=False, title='accountName', ) @@ -39,8 +37,6 @@ class VictimAssetModel( conditional_required=['EmailAddress'], description='The email address associated with the E-Mail Address asset.', methods=['POST', 'PUT'], - max_length=255, - min_length=1, read_only=False, title='address', ) @@ -80,8 +76,6 @@ class VictimAssetModel( conditional_required=['Phone'], description='The phone number of the asset.', methods=['POST', 'PUT'], - max_length=255, - min_length=1, read_only=False, title='phone', ) @@ -98,7 +92,6 @@ class VictimAssetModel( None, description='Type of victim asset.', methods=['POST'], - min_length=1, read_only=False, title='type', ) @@ -122,8 +115,6 @@ class VictimAssetModel( conditional_required=['WebSite'], description='The website of the asset.', methods=['POST', 'PUT'], - max_length=255, - min_length=1, read_only=False, title='website', ) diff --git a/tcex/api/tc/v3/victim_attributes/victim_attribute_model.py b/tcex/api/tc/v3/victim_attributes/victim_attribute_model.py index daa5dcb4f..9b8584ec0 100644 --- a/tcex/api/tc/v3/victim_attributes/victim_attribute_model.py +++ b/tcex/api/tc/v3/victim_attributes/victim_attribute_model.py @@ -97,7 +97,6 @@ class VictimAttributeModel( None, description='The attribute value.', methods=['POST', 'PUT'], - min_length=1, read_only=False, title='value', ) diff --git a/tcex/api/tc/v3/victims/victim_model.py b/tcex/api/tc/v3/victims/victim_model.py index 8e3d3121c..7ea10a883 100644 --- a/tcex/api/tc/v3/victims/victim_model.py +++ b/tcex/api/tc/v3/victims/victim_model.py @@ -57,8 +57,6 @@ class VictimModel( None, allow_mutation=False, description='Description of the Victim.', - max_length=255, - min_length=0, read_only=True, title='description', ) @@ -72,8 +70,6 @@ class VictimModel( None, description='Name of the Victim.', methods=['POST', 'PUT'], - max_length=100, - min_length=1, read_only=False, title='name', ) @@ -81,8 +77,6 @@ class VictimModel( None, description='Nationality of the Victim.', methods=['POST', 'PUT'], - max_length=100, - min_length=0, read_only=False, title='nationality', ) @@ -90,8 +84,6 @@ class VictimModel( None, description='Org of the Victim.', methods=['POST', 'PUT'], - max_length=100, - min_length=0, read_only=False, title='org', ) @@ -116,8 +108,6 @@ class VictimModel( None, description='Suborg of the Victim.', methods=['POST', 'PUT'], - max_length=100, - min_length=0, read_only=False, title='suborg', ) @@ -142,8 +132,6 @@ class VictimModel( None, description='Work location of the Victim.', methods=['POST', 'PUT'], - max_length=100, - min_length=0, read_only=False, title='workLocation', ) diff --git a/tcex/api/tc/v3/workflow_events/workflow_event_model.py b/tcex/api/tc/v3/workflow_events/workflow_event_model.py index 0609b6d3b..234591651 100644 --- a/tcex/api/tc/v3/workflow_events/workflow_event_model.py +++ b/tcex/api/tc/v3/workflow_events/workflow_event_model.py @@ -59,8 +59,6 @@ class WorkflowEventModel( None, description='The reason for deleting the event (required input for DELETE operation only).', methods=['DELETE'], - max_length=255, - min_length=1, read_only=False, title='deletedReason', ) @@ -109,8 +107,6 @@ class WorkflowEventModel( None, description='The **summary** for the Workflow_Event.', methods=['POST', 'PUT'], - max_length=255, - min_length=1, read_only=False, title='summary', ) diff --git a/tcex/api/tc/v3/workflow_templates/workflow_template_model.py b/tcex/api/tc/v3/workflow_templates/workflow_template_model.py index 8eec97209..4f101af4a 100644 --- a/tcex/api/tc/v3/workflow_templates/workflow_template_model.py +++ b/tcex/api/tc/v3/workflow_templates/workflow_template_model.py @@ -75,8 +75,6 @@ class WorkflowTemplateModel( None, description='The **description** for the Workflow_Template.', methods=['POST', 'PUT'], - max_length=1500, - min_length=0, read_only=False, title='description', ) @@ -90,8 +88,6 @@ class WorkflowTemplateModel( None, description='The **name** for the Workflow_Template.', methods=['POST', 'PUT'], - max_length=255, - min_length=1, read_only=False, title='name', ) diff --git a/tcex/app/config b/tcex/app/config index c71956343..fa3f5da8b 160000 --- a/tcex/app/config +++ b/tcex/app/config @@ -1 +1 @@ -Subproject commit c71956343abff9562060962e61670c2be6750f97 +Subproject commit fa3f5da8bf7197144594fe9bc0390398f6cabedf diff --git a/tcex/app/key_value_store b/tcex/app/key_value_store index de6e97e4f..cab3d2870 160000 --- a/tcex/app/key_value_store +++ b/tcex/app/key_value_store @@ -1 +1 @@ -Subproject commit de6e97e4fb3e59a344716967122ff475a972cd94 +Subproject commit cab3d28704444e40b3a5efeb8080d56ebe773f79 diff --git a/tcex/app/playbook b/tcex/app/playbook index 841e5d1e7..fcdb73526 160000 --- a/tcex/app/playbook +++ b/tcex/app/playbook @@ -1 +1 @@ -Subproject commit 841e5d1e727a9eb308895c29d1c289b30eb8ec4e +Subproject commit fcdb73526e94613a36bace9f1e958fbefa7ea381 diff --git a/tcex/input/model/app_system_model.py b/tcex/input/model/app_system_model.py new file mode 100644 index 000000000..5114e593c --- /dev/null +++ b/tcex/input/model/app_system_model.py @@ -0,0 +1,9 @@ +"""TcEx Framework Module""" + +# first-party +from tcex.input.model.common_model import CommonModel +from tcex.input.model.organization_model import OrganizationModel + + +class AppSystemModel(CommonModel, OrganizationModel): + """Model Definition""" diff --git a/tcex/input/model/model_map.py b/tcex/input/model/model_map.py index ff77a538a..5426b0339 100644 --- a/tcex/input/model/model_map.py +++ b/tcex/input/model/model_map.py @@ -8,6 +8,7 @@ from tcex.input.model.app_feed_api_service_model import AppFeedApiServiceModel from tcex.input.model.app_organization_model import AppOrganizationModel from tcex.input.model.app_playbook_model import AppPlaybookModel +from tcex.input.model.app_system_model import AppSystemModel from tcex.input.model.app_trigger_service_model import AppTriggerServiceModel from tcex.input.model.app_webhook_trigger_service_model import AppWebhookTriggerServiceModel from tcex.input.model.cal_setting_model import CalSettingModel @@ -44,7 +45,7 @@ 'organization': AppOrganizationModel, 'playbook': AppPlaybookModel, # special case for non-supported system based Apps - 'system': AppOrganizationModel, + 'system': AppSystemModel, 'triggerservice': AppTriggerServiceModel, 'webhooktriggerservice': AppWebhookTriggerServiceModel, } diff --git a/tcex/util b/tcex/util index bf28434db..4c017aea3 160000 --- a/tcex/util +++ b/tcex/util @@ -1 +1 @@ -Subproject commit bf28434dbc53a8acbf7a30edaf9d4f4daaf36a57 +Subproject commit 4c017aea3f8a429364e408d98ddf4ceed1d00069 diff --git a/tests/api/tc/v3/tasks/test_task_interface.py b/tests/api/tc/v3/tasks/test_task_interface.py index 1d6da6aa3..071ce561a 100644 --- a/tests/api/tc/v3/tasks/test_task_interface.py +++ b/tests/api/tc/v3/tasks/test_task_interface.py @@ -194,7 +194,7 @@ def test_task_all_filters(self, request: FixtureRequest): tasks.filter.case_id(TqlOperator.EQ, case.model.id) if task.model.completed_date: tasks.filter.completed_date(TqlOperator.EQ, task.model.completed_date) - tasks.filter.due_date(TqlOperator.GT, task_data['due_date']) + tasks.filter.due_date(TqlOperator.EQ, task_data['due_date']) if task.model.id is not None: tasks.filter.id(TqlOperator.EQ, task.model.id) tasks.filter.description(TqlOperator.EQ, task_data['description']) diff --git a/tests/app/config/test_install_json_model.py b/tests/app/config/test_install_json_model.py index b8090c56b..58b621c4c 100644 --- a/tests/app/config/test_install_json_model.py +++ b/tests/app/config/test_install_json_model.py @@ -97,6 +97,7 @@ def model_validate(self, path: str): # template requires json dump to serialize certain fields json.loads(ij.model.json(by_alias=True, exclude_defaults=True, exclude_none=True)), ignore_order=True, + exclude_paths=["root['sdkVersion']"], ) assert not ddiff, f'Failed validation of file {fqfn}'