Skip to content

Migration Guide V4 to V5

Enes Kutay SEZEN edited this page Dec 21, 2024 · 1 revision

Migration Guide - V4 to V5

The main breaking change in V5 is in the catalog module, specifically how certain functions resolve their Promises. If you are not using the affected functions in the catalog module, you can upgrade to V5 without any changes.

Function Changes

Return Value Changes

The following functions in the catalog module now return a Promise that resolves with an object containing task information, instead of resolving with void:

  • createOrReplaceItems
  • updateItems
  • deleteItems
  • createOrReplaceVariations
  • updateVariations
  • deleteVariations

Previously (V4):

constructorio.catalog.createOrReplaceItems({ items: [...] }).then(() => {});

Now (V5):

constructorio.catalog.createOrReplaceItems({ items: [...] })
  .then((response) => {
    console.log(response.task_id);
    console.log(response.task_status_path);
  });

The response object will have the following structure (example):

{
  "task_id": "your_task_id",
  "task_status_path": "/v1/tasks/your_task_id"
}

Clone this wiki locally