25.0.0 API Changelog

Breaking changes

Removed endpoints

  • GET /drafts/preview/:id

Updated isolation library used for transition actions

We have updated the library that is used to run the transition actions in an isolated environment. These are the changes:

All actions are now synchronous

You no longer have to use the await when calling certain actions (but it will still be working with it).

Replaced action getFileStream

It is no longer possible to obtain a file stream in the isolated environment. Instead, use a new action getFile(hash) that returns an object with a file buffer.

const fileData = actions.getFile('fileHash');
const buffer = fileData.buffer;

Updated action callURL

Action callURL(resource, options, isolatedOptions) now accepts three arguments and always returns an object. This action still internally uses a fetch library and the first two arguments are not changed.
But instead of returning a fetch "Response" object with functions like .text() or .json(), it will always return a plain object with properties:

{
    body: <string> | <Object>
    status: <number>,
    statusText: <string>,
    headers: Record<string, string>
}

By default, you will get the response text as a string in the body property.

If you need to get the response as a JSON, you can specify json: true as the third argument.

const response = actions.callURL('https://www.url.com/getJson', void 0, { json: true });
const jsonResponse = response.body;

To send the file, you can use the buffer returned from the getFile action:

const fileData = actions.getFile('fileHash');
actions.callURL('https://www.url.com/sendBuffer', { method: 'POST', body: fileData.buffer });

To send the data as multipart/form-data, you have to specify a custom array body and formdata: true as the third argument (FormData interface is no longer available):

const fileData = actions.getFile('fileHash');
actions.callURL('https://www.url.com/sendForm', {
    method: 'POST',
    body: [{
        key: 'propertyName',  //Text property
        value: 'propertyValue'
    }, {
        key: 'file',  //File property
        value: fileData.buffer,
        mimetype: fileData.mimetype,
        filename: fileData.name
    }]
}, { formdata: true });

To send the data as application/x-www-form-urlencoded, you have to specify a custom object body and urlencoded: true as the third argument (URLSearchParams interface is no longer available):

actions.callURL('https://www.url.com/sendUrlEncoded', {
    method: 'POST',
    body: {
        propertyA: 'AValue',
        propertyB: 'BValue'
    }
}, { urlencoded: true });