Skip to content
Open
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
328 changes: 253 additions & 75 deletions devrev-wrike-snapin.plain

Large diffs are not rendered by default.

6 changes: 6 additions & 0 deletions mappings/external_domain_metadata_comments.plain
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
- The record type 'comments' (Name: Comments) should have the following fields:
- text (display name: "Text", is required, type: rich text)
- author_id (display name: "Author ID", is required, type: reference)
- Field author_id refers to the record type "#record:users".
- task_id (display name: "Task ID", is required, type: reference)
- Field task_id refers to the record type "#record:tasks".
6 changes: 6 additions & 0 deletions mappings/external_domain_metadata_projects.plain
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
- The record type 'projects' (Name: Projects) should have the following fields:
- title (display name: "Title", is required, type: text)
- description (display name: "Description", is optional, type: rich text)
- permalink (display name: "URL", is optional, type: text)
- owners (display name: "Owners", is required, type: reference)
- Field owners refers to the record type "#record:users".
8 changes: 8 additions & 0 deletions mappings/external_domain_metadata_tasks.plain
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
- The record type 'tasks' (Name: Tasks) should have the following fields:
- title (display name: "Title", is required, type: text)
- description (display name: "Description", is required, type: rich text)
- status (display name: "Status", is required, type: text)
- permalink (display name: "URL", is required, type: text)
- responsible_ids (display name: "Responsible IDs", is required, type: reference)
- Field responsible_ids refers to the record type "#record:users".
- Type of field responsible_ids is an array with max_length 50.
4 changes: 4 additions & 0 deletions mappings/external_domain_metadata_users.plain
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
- The record type 'users' (Name: Users) should have the following fields:
- full_name (display name: "Full Name", is required, type: text)
- email (display name: "Email", is required, type: text)
- title (display name: "Title", is optional, type: text)
12 changes: 12 additions & 0 deletions mappings/initial_domain_mapping_comments.plain
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
- The record_type_mappings "comments" should have the following properties:
- Default mapping should map each external comment to a "comment" object.
- There should be a single "possible_record_type_mappings" element, specifying:
- The mapping is one-way (reverse is false, forward is true).
- There should be no custom fields in the mapping.
- The following The Stock Field Mapping Fields should be mapped using The External Transformation Method:
- field "text" should be mapped to "body" (rich text).
- field "author_id" should be mapped to "created_by_id" (use directly).
- The following The Stock Field Mapping Fields should be mapped using The DevRev Record Transformation Method:
- field "task_id" should refer to the "issue" object type.


10 changes: 10 additions & 0 deletions mappings/initial_domain_mapping_projects.plain
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
- The record_type_mappings "projects" should have the following properties:
- Default mapping should map each external project to a "product" object.
- There should be a single "possible_record_type_mappings" element, specifying:
- The mapping is one-way (reverse is false, forward is true).
- There should be no custom fields in the mapping.
- The following The Stock Field Mapping Fields should be mapped using The External Transformation Method:
- field "title" should be mapped to "name".
- field "description" should be mapped to "description".
- field "permalink" should be mapped to "item_url_field".
- field "owned_by_ids" should be mapped to "owned_by_ids".
15 changes: 15 additions & 0 deletions mappings/initial_domain_mapping_tasks.plain
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
- The record_type_mappings "tasks" should have the following properties:
- Default mapping should map each external task to a "issue" object.
- There should be a single "possible_record_type_mappings" element, specifying:
- The mapping is one-way (reverse is false, forward is true)
- There should be no custom fields in the mapping.
- The following The Stock Field Mapping Fields should be mapped using The External Transformation Method:
- field "title" should be mapped to "title"
- field "permalink" should be mapped to "item_url_field"
- field "description" should be mapped to "body" (rich text)
- field "responsible_ids" should be mapped to "owned_by_ids" (use directly)
- The following The Stock Field Mapping Fields should be mapped using The Fixed Transformation Method:
- field "priority" should contain fixed value "P2"
- field "stage" should contain fixed value "triage"
- The following The Stock Field Mapping Fields should be mapped using The DevRev Record Transformation Method:
- field "applies_to_part_id" should refer to the "product" object type
9 changes: 9 additions & 0 deletions mappings/initial_domain_mapping_users.plain
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
- The record_type_mappings "users" should have the following properties:
- Default mapping should map each external user to a "devu" user object.
- There should be a single "possible_record_type_mappings" element, specifying:
- The mapping is one-way (reverse is false, forward is true).
- There should be no custom fields in the mapping.
- The following The Stock Field Mapping Fields should be mapped using The External Transformation Method:
- field "full_name" should be mapped to "full_name".
- field "email" should be mapped to "email".
- field "title" should be mapped to "display_name".
29 changes: 29 additions & 0 deletions templates/incremental_mode_acceptance_tests.plain
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
- Validate the incremental mode with the following flow:
- Step 1:
- Execute request `curl -X POST "http://localhost:8003/external-worker.update-last-successful-sync/<sync_unit_id>" -H "Content-Type: application/json" -d '{"snap_in_version_id":"test-version-id","extend_state":{"users":{"completed":true},"cards":{"completed":true},"attachments":{"completed":true}}}'`, where `<sync_unit_id>` is `event["payload"]["event_context"]["sync_unit_id"]` in the resource [data_extraction_test.json](test_data/data_extraction_test.json).
- Step 2:
- Execute request `curl --request PUT --url 'https://api.trello.com/1/cards/688725fd3e26ebcf364bff4a?key=<TRELLO_API_KEY>&token=<TRELLO_TOKEN>&name="Card50-<uuid>"' --header 'Accept: application/json'` (replace <TRELLO_API_KEY>, <TRELLO_TOKEN> and <uuid> with the actual values).
- Expect the request to succeed.
- Step 3:
- Invoke The Extraction Function using the resource [data_extraction_incremental_test.json](test_data/data_extraction_incremental_test.json).
- Expect The Callback Server to receive from DevRev a **single** event with "event_type" that equals "EXTRACTION_DATA_DONE".
- Let `artifact_array = <event_from_callback_server>["event_data"]["artifacts"]` (array of objects).
- Expect `artifact_array` to not be empty array.
- Out of `artifact_array`, expect one of the elements to have "item_type" equal to "cards" (`:= cards_artifact`). Expect `cards_artifact["item_count"]=1`.
- Expect that there is no element in `artifact_array` with "item_type" equal to "attachments". If there is, this indicates that the attachments data was pushed to the DevRev servers, which is wrong.
- Expect that there is no element in `artifact_array` with "item_type" equal to "users". If there is, this indicates that the users data was pushed to the DevRev servers, which is wrong.

- Validate the incremental mode with the following flow:
- Step 1:
- Execute request `curl -X POST "http://localhost:8003/external-worker.update-last-successful-sync/<sync_unit_id>" -H "Content-Type: application/json" -d '{"snap_in_version_id":"test-version-id","extend_state":{"users":{"completed":true},"cards":{"completed":true},"attachments":{"completed":true}}}'`, where `<sync_unit_id>` is `event["payload"]["event_context"]["sync_unit_id"]` in the resource [data_extraction_test.json](test_data/data_extraction_test.json).
- Step 2:
- Execute request `curl --request PUT --url 'https://api.trello.com/1/cards/688725db990240b77167efef?key=<TRELLO_API_KEY>&token=<TRELLO_TOKEN>&name="Card1-<uuid>"' --header 'Accept: application/json'` (replace <TRELLO_API_KEY>, <TRELLO_TOKEN> and <uuid> with the actual values).
- Expect the request to succeed.
- Step 3:
- Invoke The Extraction Function using the resource [data_extraction_incremental_test.json](test_data/data_extraction_incremental_test.json).
- Expect The Callback Server to receive from DevRev a **single** event with "event_type" that equals "EXTRACTION_DATA_DONE".
- Let `artifact_array = <event_from_callback_server>["event_data"]["artifacts"]` (array of objects).
- Expect `artifact_array` to not be empty array.
- Out of `artifact_array`, expect one of the elements to have "item_type" equal to "cards" (`:= cards_artifact`). Expect `cards_artifact["item_count"]=1`.
- Out of `artifact_array`, expect one of the elements to have "item_type" equal to "attachments" (`:= attachments_artifact`). Expect `attachments_artifact["item_count"]=2`.
- Expect that there is no element in `artifact_array` with "item_type" equal to "users". If there is, this indicates that the users data was pushed to the DevRev servers, which is wrong.
2 changes: 1 addition & 1 deletion test_data/external_sync_unit_check.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"key": "test-key",
"key_type": "",
"org_id": "org-id",
"org_name": "Personal"
"org_name": "First space"
},
"event_context": {
"callback_url": "http://localhost:8002/callback",
Expand Down
32 changes: 30 additions & 2 deletions wrike_postman.json
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,10 @@
{
"key": "dueDate",
"value": "{\"start\":\"2020-07-01\",\"end\":\"2020-07-07\"}"
},
{
"key": "updatedDate",
"value": "{\"start\":\"2025-08-20T00:00:00Z\"}"
}
]
}
Expand All @@ -214,7 +218,7 @@
"request": {
"method": "GET",
"url": {
"raw": "{{WrikeAPI}}/folders/IEACW7SVI4OMYFIY/tasks?descendants=true&status=Active&importance=Normal&type=Planned&fields=[recurrent,attachmentCount,effortAllocation,billingType]&dueDate={\"start\":\"2020-07-01\",\"end\":\"2020-07-07\"}&pageSize=200",
"raw": "{{WrikeAPI}}/folders/IEACW7SVI4OMYFIY/tasks?descendants=true&status=Active&importance=Normal&type=Planned&fields=[recurrent,attachmentCount,effortAllocation,billingType,responsibleIds]&dueDate={\"start\":\"2020-07-01\",\"end\":\"2020-07-07\"}&pageSize=200",
"host": [
"{{WrikeAPI}}"
],
Expand Down Expand Up @@ -242,7 +246,7 @@
},
{
"key": "fields",
"value": "[recurrent,attachmentCount,effortAllocation,billingType]"
"value": "[recurrent,attachmentCount,effortAllocation,billingType,responsibleIds]"
},
{
"key": "dueDate",
Expand All @@ -251,6 +255,14 @@
{
"key": "pageSize",
"value": "200"
},
{
"key": "nextPageToken",
"value": "AFGM35QAAAAAUAAAAAAQAAAABIAAAAAB4FVYIMRO4RBAE"
},
{
"key": "updatedDate",
"value": "{\"start\":\"2025-08-20T00:00:00Z\"}"
}
]
}
Expand Down Expand Up @@ -347,8 +359,24 @@
"tasks",
"IEACW7SVKQOKD5EG",
"attachments"
],
"query": [
{
"key": "withUrls",
"value": "true"
}
]
}
},
"response": {
"name": "Get Attachments on Task",
"originalRequest": {
"method": "GET",
"url": "{{WrikeAPI}}/tasks/IEACW7SVKQOKD5EG/attachments"
},
"status": "OK",
"code": 200,
"body": "{\"kind\":\"attachments\",\"data\":[{\"id\":\"IEACW7SVIYEV4HBN\",\"authorId\":\"IEAGS6BY\",\"name\":\"Result from test.com\",\"createdDate\":\"2025-07-25T07:53:33Z\",\"version\":\"1\",\"size\":1024,\"type\":\"application/vnd.openxmlformats-officedocument.wordprocessingml.document\",\"url\":\"https://www.wrike.com/attachments/IEACW7SVIYEV4HBN/download/Lorem Ipsum.docx\",\"taskId\":\"IEACW7SVKQOKD5EG\",\"width\":100,\"height\":100}]}"
}
},
{
Expand Down
Loading