Skip to content
Open
Show file tree
Hide file tree
Changes from all 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
323 changes: 249 additions & 74 deletions devrev-wrike-snapin.plain

Large diffs are not rendered by default.

8 changes: 8 additions & 0 deletions mappings/external_domain_metadata_comments.plain
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
- 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".
- Type of field author_id is an array with max_length 1, which can be used directly.
- task_id (display name: "Task ID", is required, type: reference)
- Field task_id refers to the record type "#record:tasks".
- Type of field task_id is an array with max_length 1, which can be used directly.
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 1, which can be used as array value.
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)
10 changes: 10 additions & 0 deletions mappings/initial_domain_mapping_comments.plain
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
- 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.
20 changes: 20 additions & 0 deletions mappings/initial_domain_mapping_tasks.plain
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
- 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 "status" should be mapped to "stage" in the following way:
- "Active" maps to "in_development"
- "Completed" maps to "completed"
- "Deferred" maps to "backlog"
- "Cancelled" maps to "wont_fix"
- 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".
31 changes: 31 additions & 0 deletions templates/incremental_mode_acceptance_tests.plain
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
- 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},"tasks":{"completed":true},"attachments":{"completed":true},"comments":{"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 -g -X PUT -H 'Authorization: bearer <WRIKE_API_KEY>' -d 'title=<NEW_TITLE>' 'https://www.wrike.com/api/v4/tasks/MAAAAABlGv5B'` (replace <WRIKE_API_KEY> and <NEW_TITLE> 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 "tasks" (`:= tasks_artifact`). Expect `tasks_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.
- Expect that there is no element in `artifact_array` with "item_type" equal to "comments". If there is, this indicates that the comments 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},"tasks":{"completed":true},"attachments":{"completed":true},"comments":{"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 -g -X PUT -H 'Authorization: bearer <WRIKE_API_KEY>' -d 'title=<NEW_TITLE>' 'https://www.wrike.com/api/v4/tasks/IEAGS6BYKRRFMPQE'` (replace <WRIKE_API_KEY> and <NEW_TITLE> 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 "tasks" (`:= tasks_artifact`). Expect `tasks_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"]=1`.
- Out of `artifact_array`, expect one of the elements to have "item_type" equal to "comments" (`:= comments_artifact`). Expect `comments_artifact["item_count"]=3`.
- 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.
75 changes: 75 additions & 0 deletions test_data/attachments_extraction_continue_test.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
[
{
"payload": {
"connection_data": {
"key": "<WRIKE_API_KEY>",
"key_type": "",
"org_id": "<WRIKE_SPACE_ID>",
"org_name": "First Space"
},
"event_context": {
"callback_url": "http://localhost:8002/callback",
"dev_oid": "DEV-36shCCBEAA",
"dev_org": "DEV-36shCCBEAA",
"dev_org_id": "DEV-36shCCBEAA",
"dev_uid": "DEVU-6",
"dev_user": "DEVU-6",
"dev_user_id": "DEVU-6",
"event_type_adaas": "",
"external_sync_unit": "688725dad59c015ce052eecf",
"external_sync_unit_id": "688725dad59c015ce052eecf",
"external_sync_unit_name": "cards-pagination-test-2025-07-28-092514",
"external_system": "6752eb95c833e6b206fcf388",
"external_system_id": "6752eb95c833e6b206fcf388",
"external_system_name": "Wrike",
"external_system_type": "ADaaS",
"import_slug": "wrike-snapin-devrev",
"initial_sync_scope": "full-history",
"mode": "INITIAL",
"request_id": "ff894fd5-2290-42bb-9f89-0785e49b4049",
"request_id_adaas": "ff894fd5-2290-42bb-9f89-0785e49b4049",
"run_id": "cbbe2419-1f86-4737-aa78-6bb7118ce52c",
"sequence_version": "17",
"snap_in_slug": "wrike-snapin-devrev",
"snap_in_version_id": "don:integration:dvrv-eu-1:devo/36shCCBEAA:snap_in_package/787b97af-95a8-4b57-809e-8d55f4e72f40:snap_in_version/50d4660e-dad9-41D6-9169-8a7e96b2d7fa",
"sync_run": "cbbe2419-1f86-4737-aa78-6bb7118ce52c",
"sync_run_id": "cbbe2419-1f86-4737-aa78-6bb7118ce52c",
"sync_tier": "sync_tier_2",
"sync_unit": "don:integration:dvrv-eu-1:devo/36shCCBEAA:external_system_type/ADAAS:external_system/6752eb95c833e6b206fcf388:sync_unit/984c894e-71e5-4e94-b484-40b839c9a916",
"sync_unit_id": "984c894e-71e5-4e94-b484-40b839c9a916",
"uuid": "ff894fd5-2290-42bb-9f89-0785e49b4049",
"worker_data_url": "http://localhost:8003/external-worker"
},
"event_type": "EXTRACTION_ATTACHMENTS_CONTINUE"
},
"context": {
"dev_oid": "don:identity:dvrv-eu-1:devo/36shCCBEAA",
"automation_id": "",
"source_id": "",
"snap_in_id": "don:integration:dvrv-eu-1:devo/36shCCBEAA:snap_in/04bf12fa-57bd-4057-b0b0-ed3f42d9813e",
"snap_in_version_id": "don:integration:dvrv-eu-1:devo/36shCCBEAA:snap_in_package/787b97af-95a8-4b57-809e-8d55f4e72f40:snap_in_version/50d4660e-dad9-41D6-9169-8a7e96b2d7fa",
"service_account_id": "don:identity:dvrv-eu-1:devo/36shCCBEAA:svcacc/101",
"secrets": {
"service_account_token": "test-service-account-token"
},
"user_id": "don:identity:dvrv-eu-1:devo/36shCCBEAA:devu/6",
"event_id": "",
"execution_id": "4481432207487786275"
},
"execution_metadata": {
"request_id": "ff894fd5-2290-42bb-9f89-0785e49b4049",
"function_name": "extraction",
"event_type": "EXTRACTION_ATTACHMENTS_START",
"devrev_endpoint": "http://localhost:8003"
},
"input_data": {
"global_values": {},
"event_sources": {},
"keyrings": null,
"resources": {
"keyrings": {},
"tags": {}
}
}
}
]
75 changes: 75 additions & 0 deletions test_data/attachments_extraction_test.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
[
{
"payload": {
"connection_data": {
"key": "<WRIKE_API_KEY>",
"key_type": "",
"org_id": "<WRIKE_SPACE_ID>",
"org_name": "First Space"
},
"event_context": {
"callback_url": "http://localhost:8002/callback",
"dev_oid": "DEV-36shCCBEAA",
"dev_org": "DEV-36shCCBEAA",
"dev_org_id": "DEV-36shCCBEAA",
"dev_uid": "DEVU-6",
"dev_user": "DEVU-6",
"dev_user_id": "DEVU-6",
"event_type_adaas": "",
"external_sync_unit": "688725dad59c015ce052eecf",
"external_sync_unit_id": "688725dad59c015ce052eecf",
"external_sync_unit_name": "cards-pagination-test-2025-07-28-092514",
"external_system": "6752eb95c833e6b206fcf388",
"external_system_id": "6752eb95c833e6b206fcf388",
"external_system_name": "Wrike",
"external_system_type": "ADaaS",
"import_slug": "wrike-snapin-devrev",
"initial_sync_scope": "full-history",
"mode": "INITIAL",
"request_id": "ff894fd5-2290-42bb-9f89-0785e49b4049",
"request_id_adaas": "ff894fd5-2290-42bb-9f89-0785e49b4049",
"run_id": "cbbe2419-1f86-4737-aa78-6bb7118ce52c",
"sequence_version": "17",
"snap_in_slug": "wrike-snapin-devrev",
"snap_in_version_id": "don:integration:dvrv-eu-1:devo/36shCCBEAA:snap_in_package/787b97af-95a8-4b57-809e-8d55f4e72f40:snap_in_version/50d4660e-dad9-41D6-9169-8a7e96b2d7fa",
"sync_run": "cbbe2419-1f86-4737-aa78-6bb7118ce52c",
"sync_run_id": "cbbe2419-1f86-4737-aa78-6bb7118ce52c",
"sync_tier": "sync_tier_2",
"sync_unit": "don:integration:dvrv-eu-1:devo/36shCCBEAA:external_system_type/ADAAS:external_system/6752eb95c833e6b206fcf388:sync_unit/984c894e-71e5-4e94-b484-40b839c9a916",
"sync_unit_id": "984c894e-71e5-4e94-b484-40b839c9a916",
"uuid": "ff894fd5-2290-42bb-9f89-0785e49b4049",
"worker_data_url": "http://localhost:8003/external-worker"
},
"event_type": "EXTRACTION_ATTACHMENTS_START"
},
"context": {
"dev_oid": "don:identity:dvrv-eu-1:devo/36shCCBEAA",
"automation_id": "",
"source_id": "",
"snap_in_id": "don:integration:dvrv-eu-1:devo/36shCCBEAA:snap_in/04bf12fa-57bd-4057-b0b0-ed3f42d9813e",
"snap_in_version_id": "don:integration:dvrv-eu-1:devo/36shCCBEAA:snap_in_package/787b97af-95a8-4b57-809e-8d55f4e72f40:snap_in_version/50d4660e-dad9-41D6-9169-8a7e96b2d7fa",
"service_account_id": "don:identity:dvrv-eu-1:devo/36shCCBEAA:svcacc/101",
"secrets": {
"service_account_token": "test-service-account-token"
},
"user_id": "don:identity:dvrv-eu-1:devo/36shCCBEAA:devu/6",
"event_id": "",
"execution_id": "4481432207487786275"
},
"execution_metadata": {
"request_id": "ff894fd5-2290-42bb-9f89-0785e49b4049",
"function_name": "extraction",
"event_type": "EXTRACTION_ATTACHMENTS_START",
"devrev_endpoint": "http://localhost:8003"
},
"input_data": {
"global_values": {},
"event_sources": {},
"keyrings": null,
"resources": {
"keyrings": {},
"tags": {}
}
}
}
]
76 changes: 76 additions & 0 deletions test_data/data_extraction_continue_test.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@

[
{
"payload": {
"connection_data": {
"key": "test-key",
"key_type": "",
"org_id": "test-org-id",
"org_name": "My FOlder"
},
"event_context": {
"callback_url": "http://localhost:8002/callback",
"dev_oid": "test-dev-oid",
"dev_org": "test-dev-org",
"dev_org_id": "test-dev-org-id",
"dev_uid": "test-dev-uid",
"dev_user": "test-dev-user",
"dev_user_id": "test-dev-user-id",
"event_type_adaas": "",
"external_sync_unit": "test-external_sync_unit",
"external_sync_unit_id": "test-external_sync_unit_id",
"external_sync_unit_name": "test-external_sync_unit_name",
"external_system": "test-external_system",
"external_system_id": "test-external_system_id",
"external_system_name": "Wrike",
"external_system_type": "ADaaS",
"import_slug": "trello-wrike-devrev",
"initial_sync_scope": "full-history",
"mode": "INITIAL",
"request_id": "test-request-id",
"request_id_adaas": "test-request-id-adaas",
"run_id": "test-run_id",
"sequence_version": "10",
"snap_in_slug": "wrike-snapin-devrev",
"snap_in_version_id": "don:integration:dvrv-eu-1:devo/test:snap_in_package/test:snap_in_version/test",
"sync_run": "test-sync_run",
"sync_run_id": "test-sync_run_id",
"sync_tier": "sync_tier_2",
"sync_unit": "don:integration:dvrv-eu-1:devo/test:external_system_type/ADAAS:external_system/test:sync_unit/test",
"sync_unit_id": "test-sync_unit_id",
"uuid": "test-uuid",
"worker_data_url": "http://localhost:8003/external-worker"
},
"event_type": "EXTRACTION_DATA_CONTINUE"
},
"context": {
"dev_oid": "don:identity:dvrv-eu-1:devo/test",
"automation_id": "",
"source_id": "",
"snap_in_id": "test-don:integration:dvrv-eu-1:devo/test:snap_in/test",
"snap_in_version_id": "test-don:integration:dvrv-eu-1:devo/test:snap_in_package/test:snap_in_version/test",
"service_account_id": "test-don:identity:dvrv-eu-1:devo/test:svcacc/74",
"secrets": {
"service_account_token": "test-service-account-token"
},
"user_id": "don:identity:dvrv-eu-1:devo/test:devu/6",
"event_id": "",
"execution_id": "test-execution-id"
},
"execution_metadata": {
"request_id": "test-request-id",
"function_name": "extraction",
"event_type": "EXTRACTION_DATA_CONTINUE",
"devrev_endpoint": "http://localhost:8003"
},
"input_data": {
"global_values": {},
"event_sources": {},
"keyrings": null,
"resources": {
"keyrings": {},
"tags": {}
}
}
}
]
Loading
Loading