Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

@kontent-ai/delivery-sdk

kontent-ai48.5kMIT16.4.0TypeScript support: included

Official Kontent.AI Delivery API SDK

Kontent, Kontent.ai, Kontent SDK, Kontent API, Kontent Delivery, Kontent Javascript, Kontent Node.js, Kontent Typescript

readme

npm version Build npm Known Vulnerabilities GitHub license Gzip browser bundle Discord

JavaScript Delivery SDK Documentation

This library is build for fetching Kontent.ai data with Delivery API. Works in browser & node.

[!TIP]
It's highly recommended to use this library in combination with Model Generator. Generating models will greatly increase type safety of your code and offer you an advanced intellisense.

Kontent.ai Delivery SDK

Installation

npm i @kontent-ai/delivery-sdk --save

Getting started

import { type IContentItem, type Elements, createDeliveryClient } from '@kontent-ai/delivery-sdk';

/**
 * Generate models with @kontent-ai/model-generator
 */
export type Movie = IContentItem<{
    readonly title: Elements.TextElement;
    readonly plot: Elements.RichTextElement;
    readonly released: Elements.DateTimeElement;
    readonly length: Elements.NumberElement;
    readonly poster: Elements.AssetsElement;
    readonly category: Elements.MultipleChoiceElement;
    readonly stars: Elements.LinkedItemsElement<Actor>;
    readonly seoname: Elements.UrlSlugElement;
    readonly releasecategory: Elements.TaxonomyElement;
}>;

// Both `CoreDeliveryClient` and `CoreClientTypes` are types generated by @kontent-ai/model-generator
// By using the generated types you will get access to advanced intellisense & type safety
const deliveryClient: CoreDeliveryClient = createDeliveryClient<CoreClientTypes>({
    environmentId: '<YOUR_ENVIRONMENT_ID>'
});

// fetch items
const response = await deliveryClient.items<Movie>().type('<CONTENT_TYPE_CODENAME>').toPromise();

// read data of first item
const movieText = response.data.items[0].elements.title.value;

Configuration

Property type description
environmentId string environmentId of your Kontent.ai project
elementResolver? ElementResolver Element resolver used to map custom elements
previewApiKey? string Preview API key used to get unpublished content items
defaultLanguage? string Sets default language that will be used for all queries unless overridden with query parameters
proxy? IDeliveryClientProxyConfig Can be used to configure custom URLs. Useful when you use reverse proxy or have a need to transform URL - e.g. to remove 'environmentId'
secureApiKey? string Secured API key: Use secured API only when running on Node.JS server, otherwise you can expose your key
defaultQueryConfig? IQueryConfig Default configuration for all queries. Can be overridden by individual queries
httpService ? IHttpService Can be used to inject custom http service for performing requests
globalHeaders? (queryConfig: IQueryConfig) => IHeader[] Adds ability to add extra headers to each http request
retryStrategy? IRetryStrategyOptions Retry strategy configuration
linkedItemsReferenceHandler? LinkedItemsReferenceHandler Indicates if content items are automatically mapped. Available values: 'map' or 'ignore'
assetsDomain? string Custom domain for assets. Changes url of assets in both asset & rich text elements
defaultRenditionPreset? string Codename of rendition preset to be applied by default to the base asset URL path when present. When set, the SDK will provide the URL of customized images by default. Right now the only supported preset codename is default.
excludeArchivedItems? boolean Can be used to exclude archived items from all queries by default. Only applicable when preview API is used.

Querying

The SDK supports the following query parameters: depthParameter, elementsParameter, excludeElementsParameter, limitParameter, orderParameter, skipParameter and languageParameter. For more information about the parameters, see the SDK query methods below. You can also head over to Delivery API reference.

// Gets 5 items based on the Movie type
deliveryClient.items<Movie>().type('movie').limitParameter(5).skipParameter(2).toPromise();
Filter
depthParameter
elementsParameter
excludeElementsParameter
limitParameter
orderParameter
skipParameter
languageParameter

Filtering

Filters are also considered query parameters and can be combined. See Content filtering in API reference for more examples.

// Gets items based on the Movie type with 'Warrior' in their 'Title' element
deliveryClient.items<Movie>().type('movie').equalsFilter('elements.title', 'Warrior').toPromise();
Filter
type
types
allFilter
anyFilter
containsFilter
equalsFilter
greaterThanFilter
greaterThanOrEqualFilter
inFilter
lessThanFilter
lessThanOrEqualFilter
rangeFilter
emptyFilter
NotEmptyFilter
notEqualsFilter
notInFilter

Soring

You can sort data by using any of the following methods:

deliveryClient.items<Movie>().type('movie').orderByDescending('elements.title').toPromise();
deliveryClient.items<Movie>().type('movie').orderByAscending('elements.title').toPromise();
deliveryClient.items<Movie>().type('movie').orderParameter('elements.title', 'desc').toPromise();

Execute queries with a custom URL

When you have an URL (i.e. for next page in paging, for testing purposes or just if you prefer to build it on your own) and still want to leverage SDK functionality such as type mapping, property resolving etc., use withUrl parameter on any query such as:

deliveryClient
    .items<Movie>()
    .withUrl('https://deliver.kontent.ai/da5abe9f-fdad-4168-97cd-b3464be2ccb9/items?system.type=movie')
    .toPromise();

Custom parameters

In case you need to use custom parameters to build up an URL, use withParameter method:

deliveryClient.items<Movie>().withParameter('name', 'value').toPromise();

Get localized items

You can specify language of items with languageParameter of a particular query. You can also define default language that will be used if languageParameter is not used during the initialization of delivery client.

import { createDeliveryClient } from '@kontent-ai/delivery-sdk';

var deliveryClient = new createDeliveryClient({
    environmentId: '<YOUR_ENVIRONMENT_ID>',
    defaultLanguage: 'es'
});

// Gets items in 'es' language because it is marked as default
deliveryClient.item('warrior').toPromise();

// Gets items in 'en' language because language parameter has priority over the default one
deliveryClient.item('warrior').languageParameter(`en`).toPromise();

Preview mode

You can enable the preview mode either globally (when initializing the DeliveryClient) or per query. In each case, you need to set previewApiKey in the delivery client global configuration.

Enable preview mode globally

import { createDeliveryClient } from '@kontent-ai/delivery-sdk';

const deliveryClient = createDeliveryClient({
  environmentId: '<YOUR_ENVIRONMENT_ID>';
  previewApiKey: '<YOUR_PREVIEW_API_KEY>',
  defaultQueryConfig: {
    usePreviewMode: true
  }
});

Enable preview mode per query

deliveryClient
    .items()
    .queryConfig({
        usePreviewMode: true
    })
    .toPromise();

Secure Delivery API

Using the Delivery API with secure access enabled is recommend only when the request is not being executed on the client (browser) because otherwise you will expose the API key publicly.

import { createDeliveryClient } from '@kontent-ai/delivery-sdk';

const deliveryClient = createDeliveryClient({
  environmentId: '<YOUR_ENVIRONMENT_ID>';
  secureApiKey: '<YOUR_SECURE_ACCESS_KEY>',
    defaultQueryConfig: {
      // Enabled secure access for all queries
      useSecuredMode: true
  }
});

As with preview mode, you can also override global settings on query level.

deliveryClient
    .items()
    .queryConfig({
        // Enables secure access only for this query
        useSecuredMode: true
    })
    .toPromise();

Image transformation

Use ImageUrlBuilder for your image transformations on asset URLs.

import { transformImageUrl } from '@kontent-ai/delivery-sdk';

// Sample asset URL; You'll find URLs like these in asset and rich text elements
const assetUrl = `https://assets-eu-01.kc-usercontent.com/ede994d8-bb05-01b5-9c33-8b65e7372306/4f45e0a8-4fc3-4143-a81f-55b7e4ce7daa/warrior.jpg`;

const transformedUrl = transformImageUrl(assetUrl)
    .withDpr(2)
    .withCompression('lossless')
    .withQuality(4)
    .withHeight(200)
    .withWidth(100)
    .getUrl();

Paging

All listing queries support automatic paging. To use automatic paging, use toAllPromise extension method:

// this executed multiple HTTP requests until it gets all items
const response = await deliveryClient.items().limitParameter(5).toAllPromise();

// only gets 3 pages at maximum
const response = await deliveryClient.items().limitParameter(5).toAllPromise({
    pages: 3
});

Resolving rich text elements

Rich text elements in Kontent.ai may contain linked items and components. For example, if you write a blog post, you might want to insert a video or testimonial to a specific place in your article.

To learn how to work with Rich text element have a look at @kontent-ai/rich-text-resolver library.

Get content types

deliveryClient.type('movie').toPromise();
deliveryClient.types().toPromise();
deliveryClient.types().toAllPromise();

Get taxonomies

deliveryClient.taxonomy('taxonomyGroupName').toPromise();
deliveryClient.taxonomies().toPromise();
deliveryClient.taxonomies().toAllPromise();

Proxy configuration

If you want to use a proxy server, you need to use a different domain or otherwise transform the URL. By using proxy configuration option you can define your own base domains as well as URL format. This is useful if you need to for example hide the environmentId from the URL.

IDeliveryClientProxyConfig offers 3 ways of configuring proxy URL:

  1. baseUrl - Base URL used for all requests. Defaults to 'deliver.kontent.ai'
  2. basePreviewUrl - Base url used for preview requests. Defaults to 'preview-deliver.kontent.ai'
  3. advancedProxyUrlResolver - Resolver function where you get IProxyUrlData context data (includes domain, action, query parameters..) and can fully customize the final URL.

Examples:

const client = createDeliveryClient({
    environmentId: '<YOUR_ENVIRONMENT_ID>',
    // Will be used instead of 'https://deliver.kontent.ai' for all requests.
    // Parameters, filters, project Id and other parts of the URL will use default values.
    proxy: {
        baseUrl: 'http://my-proxy.io'
    }
});
const client = createDeliveryClient({
    environmentId: '<YOUR_ENVIRONMENT_ID>',
    proxy: {
        advancedProxyUrlResolver: (data) => {
            const action = data.action; // /items
            const domain = data.domain; // https://deliver.kontent.ai
            const environmentId = data.environmentId; // xxx
            const queryString = data.queryString; // e.g. ?depth=1&elements=xElement
            const queryParameters = data.queryParameters; // array with query parameters parameters
            const queryConfig = data.queryConfig; // query configuration
            return `http://my-proxy.io${action}${queryString}`; // proxy URL with omitted project Id
        }
    }
});

Error handling

If the error originates in Kontent.ai (see error responses), you will get a DeliveryError object instance with more specific information. Otherwise, you will get the original error.

import { DeliveryError } from '@kontent-ai/delivery-sdk';

try {
    await deliveryClient.item('invalid_codename').toPromise();
} catch (error) {
    if (error instanceof DeliveryError) {
        // delivery specific error (e.g. item with codename not found...)
        console.log(err.message, err.errorCode);
    } else {
        // some other error
        console.log(error);
    }
}

Remapping json responses

In some scenarios, you might want to store json response for later use and use SDK to map the response for you. There are 2 ways you can map previously stored json:

const result = await deliveryClient.item<Movie>('codename').toPromise();
const json = result.response.data;

// approach #1
const remappedData = deliveryClient.mappingService.viewContentItemResponse<Movie>(json);

// approach #2
const remappedData = deliveryClient.item<Movie>(movieCodename).map(json);

Handling circular references

By default, the SDK automatically maps content items present in linked items & rich text elements. Linked items can reference other linked items in their tree (e.g. child item referencing parent) which may cause infinite nesting (circular reference). This behavior is not an issue for most scenarios, in fact it is beneficial as you can easily access all linked items. However, you cannot easily serialize such model. Using e.g. JSON.stringify would fail if there are circular references.

For this reason, you may disable mapping of linked items with linkedItemsReferenceHandler configuration option.

const client = getTestDeliveryClient({
    environmentId: '<YOUR_ENVIRONMENT_ID>',
    linkedItemsReferenceHandler: 'ignore' // or 'map'
});

Using custom HTTP service

The SDK allows you to inject your own instance of a class implementing the IHttpService interface. This way you can easily mock responses, implement your own http service, or modify the requests in some other way.

Sample of a test HttpService implementation can be found at https://github.com/kontent-ai/core-sdk-js

Once you have your HttpService, use it in delivery client initialization:

const deliveryClient = createDeliveryClient({
    environmentId: '<YOUR_ENVIRONMENT_ID>',
    httpService: YourHttpServiceImplementation
});

Use custom models for Custom elements

You can register an ElementResolver to map custom elements into dedicated element models and work with data more effectively.

For example, if you have a custom color element in your Kontent.ai project with json data like:

 "color": {
  "type": "custom",
  "name": "Color",
  "value": "{\"red\":167,\"green\":96,\"blue\":197}"
  }

You can create a ColorElement type with strongly typed properties for red, green & blue values that you will parse from the json.

import { ElementModels, Elements, createDeliveryClient } from '@kontent-ai/delivery-sdk';

type ColorElement = Elements.CustomElement<{
    red: number;
    green: number;
    blue: number;
}>;

To resolve your custom element into ColorElement, use the ElementResolver in your delivery client config:

const client = createDeliveryClient({
    environmentId: '<YOUR_ENVIRONMENT_ID>',
    elementResolver: (elementWrapper) => {
        if (elementWrapper.rawElement.type === 'color') {
            const parsed = JSON.parse(elementWrapper.rawElement.value);

            return {
                red: parsed.red,
                green: parsed.green,
                blue: parsed.blue
            };
        }

        return undefined;
    }
});

You can then use this custom element type in your models:

type Movie = IContentItem<{
    color: ColorElement;
    title: Elements.TextElement;
}>;

UMD bundles

When using UMD bundle and including this library in script tag on your html page, you can find it under the kontentDelivery global variable.

Bundles are distributed in dist/bundles folder:

  • dist/bundles/kontent-delivery.umd.js
  • dist/bundles/kontent-delivery.umd.min.js

Debugging

Accessing request data

Every response from this SDK contains additional debug data you can use to inspect when something is not right or if you need to access response headers or other network related properties.

const deliveryResponse = await createDeliveryClient({ environmentId: 'environmentId' })
    .item('itemCodename')
    .toPromise();
const rawResponseData = deliveryResponse.response; // contains raw response data, headers, status etc..
const responseHeaders = deliveryResponse.response.headers;

Getting URL of a query

In case you need to get the raw URL of a request before calling it, use the getUrl() method on any query.

const queryText = deliveryClient
    .items()
    .type('movie')
    .limitParameter(10)
    .orderParameter('system.codename', 'desc')
    .getUrl();

console.log(queryText);
// outputs:
// https://deliver.kontent.ai/b52fa0db-84ec-4310-8f7c-3b94ed06644d/items?limit=10&order=system.codename[desc]&system.type=movie

Testing

Note: You need to have Chrome installed in order to run tests via Karma.

  • npm run test:browser Runs tests in Chrome
  • npm run test:node Runs tests in node.js
  • npm run test:all Runs all test

If you want to mock http responses, it is possible to use custom Http Service as a part of the delivery client configuration.

Feedback & Contribution

Feedback & Contributions are welcomed. Feel free to take/start an issue & submit PR.

changelog

Changelog

All notable changes to this project will be documented in this file. See standard-version for commit guidelines.

16.4.0 (2025-11-11)

Features

16.3.0 (2025-08-05)

Features

16.2.1 (2025-07-03)

16.2.0 (2025-04-30)

Features

Bug Fixes

  • models: correct typo in workflowStepCodenames property (58428fd)

16.1.0 (2025-04-10)

Features

  • Adds delivery client types to items feed query (f834b31)
  • Adds support for asset/item used queries (a321d40)
  • updates deps (5e52ac6)

16.0.0 (2025-03-11)

Features

  • adds support for client generics, improving type safety (89cbc39)
  • updates deps (7f957d0)

16.0.0-0 (2025-02-13)

Features

  • adds support for client generics, improving type safety in combination with model generator (d45a0e3)
  • removes url-parse package in favor of native URL class (34bfe8f)
  • updates deps (6335bba)

Bug Fixes

  • package.json & package-lock.json to reduce vulnerabilities (da3b536)

15.2.0 (2024-09-27)

Features

  • exports optional 'Snippet' type used for strongly typed modelling (96ef2d5)

15.1.1 (2024-09-27)

Bug Fixes

  • re-exports IContentItemElements type (ddc570f)

15.1.0 (2024-09-26)

Features

  • Adds support for constraining item element properties using pre-defined codenames type (c7b16b7)
  • updates deps (03fdc22)

15.0.0 (2024-09-16)

Features

15.0.0-0 (2024-09-10)

⚠ BREAKING CHANGES

  • Removes parser & rich text resolver. To work with RTE use the newer and better @kontent-ai/rich-text-resolver library instead.
  • Removes propertyName resolver configuration. All elements are now referenced only by their codenames present in Kontent.ai

Features

  • Adds narrowing types for Taxonomy & Multiple choice elements (3118752)
  • Adds optional generic types to IContentItem narrowing down available values of system attributes (8c894af)
  • Makes RichTextElement take generic parameter narrowing down allowed types of linked items (68b31a8)
  • Removes propertyName resolver configuration. All elements are now referenced only by their codenames present in Kontent.ai (7ef5951)
  • Removes parser & rich text resolver. To work with RTE use the newer and better @kontent-ai/rich-text-resolver library instead. (2bd30c3)
  • updates deps (82c2c11)

Upgrading to new RTE parser

In < 15.0.0 versions of this SDK you were able to resolve RTE elements like this:

import { createRichTextHtmlResolver, createDeliveryClient, linkedItemsHelper } from '@kontent-ai/delivery-sdk';

export type Movie = IContentItem<{
    plot: Elements.RichTextElement;
}>;

export type Actor = IContentItem<{
    firstName: Elements.RichTextElement;
}>;

// get content item with rich text element
const response = (
    await createDeliveryClient({ environmentId: '<YOUR_ENVIRONMENT_ID>' }).item<Movie>('itemCodename').toPromise()
).data;

// get rich text element
const richTextElement = response.item.plot;

// resolve HTML
const resolvedRichText = createRichTextHtmlResolver().resolveRichText({
    element: richTextElement,
    linkedItems: linkedItemsHelper.convertLinkedItemsToArray(response.data.linkedItems),
    imageResolver: (imageId, image) => {
        return {
            imageHtml: `<img class="xImage" src="${image?.url}">`,
            // alternatively you may return just url
            imageUrl: 'customUrl'
        };
    },
    urlResolver: (linkId, linkText, link) => {
        return {
            linkHtml: `<a class="xLink">${link?.link?.urlSlug}</a>`,
            // alternatively you may return just url
            linkUrl: 'customUrl'
        };
    },
    contentItemResolver: (itemId, contentItem) => {
        if (contentItem && contentItem.system.type === 'actor') {
            const actor = contentItem as Actor;
            return {
                contentItemHtml: `<div class="xClass">${actor.elements.firstName.value}</div>`
            };
        }

        return {
            contentItemHtml: ''
        };
    }
});

const resolvedHtml = resolvedRichText.html;

But since this resolver is now removed in >= 15.0.0 you need to resolve RTE using the @kontent-ai/rich-text-resolver package:

import { createDeliveryClient, Elements, IContentItem } from '@kontent-ai/delivery-sdk';
import { PortableTextOptions, toHTML } from '@portabletext/to-html';
import { nodeParse, transformToPortableText, resolveTable, resolveImage } from '@kontent-ai/rich-text-resolver';

type Movie = IContentItem<{
    title: Elements.TextElement;
    plot: Elements.RichTextElement<Actor>;
}>;

type Actor = IContentItem<{
    first_name: Elements.RichTextElement;
}>;

const itemResponse = await createDeliveryClient({
    environmentId: 'da5abe9f-fdad-4168-97cd-b3464be2ccb9'
})
    .item<Movie>('warrior')
    .toPromise();

const richTextElement = itemResponse.data.item.elements.plot;

const linkedItems = Object.values(itemResponse.data.linkedItems);
const parsedTree = nodeParse(richTextElement.value);
const portableText = transformToPortableText(parsedTree);

const portableTextComponents: PortableTextOptions = {
    components: {
        types: {
            image: ({ value }) => {
                return resolveImage(value, (image) => {
                    return `<img class="xImage" src="${image.asset.url}">`;
                });
            },
            component: ({ value }) => {
                const linkedItem = linkedItems.find((item) => item.system.codename === value.component._ref);
                switch (linkedItem?.system.type) {
                    case 'actor': {
                        const actor = linkedItem as Actor;
                        return `<div class="xClass">${actor.elements.first_name.value}</div>`;
                    }
                    default: {
                        return `Resolver for type ${linkedItem?.system.type} not implemented.`;
                    }
                }
            },
            table: ({ value }) => {
                // default impl
                return resolveTable(value, toHTML);
            }
        },
        marks: {
            internalLink: ({ children, value }) => {
                return `<a class="xLink" href="https://yourdomain.com/actor/${value.reference._ref}">${children}</a>`;
            }
        }
    }
};

const resolvedHtml = toHTML(portableText, portableTextComponents);

14.11.0 (2024-08-15)

Features

  • updates deps (& fixes Axios vulnerability), updates eslint config (ba49770)

14.10.0 (2024-06-28)

Features

14.9.0 (2024-04-29)

Features

14.8.0 (2024-03-06)

Features

14.7.0 (2024-02-29)

Features

Bug Fixes

14.6.0 (2023-12-19)

Features

  • Adds 'workflow' to system attributes (6a0bf11)

14.5.0 (2023-11-16)

Features

14.4.0 (2023-08-21)

Features

  • Adds 'excludeArchivedItems' client configuration & fixes element endpoint mapping due to API change (19f3fff)
  • updates deps & increases required node version (4b0dee3)

14.3.1 (2023-08-02)

Bug Fixes

14.3.0 (2023-07-31)

Features

  • updates deps, migrates to eslint, adds migrate related code fixes (288cbb7)

Bug Fixes

14.2.0 (2023-06-02)

Features

  • adds support for linking items across responses when using toAllPromise items endpoint (67e8e16)
  • updates dependencies (b83b3bd)

14.1.0 (2023-05-16)

Features

  • rangeFilter now accepts strings, other comparison filters now accept numbers (14e53e8)
  • updates deps (3723aa0)

Bug Fixes

  • Preserves linked items order when using items-feed with item mapping (e62d261)

14.0.1 (2023-04-12)

Bug Fixes

  • fixes sync endpoint URL (removes early-access) (0fa47b1)

14.0.0 (2023-04-12)

⚠ BREAKING CHANGES

  • Renames project_id to environment_id across entire library

13.0.0 (2023-04-12)

⚠ BREAKING CHANGES

Features

12.4.3 (2023-02-20)

Bug Fixes

  • Handles '+' sign in name resolvers (e30f235)

12.4.2 (2022-11-21)

  • Adds support for timezone in date elements

12.4.1 (2022-11-01)

Bug Fixes

  • fixes query configuration for initialize sync POST request (42f317c)

12.4.0 (2022-10-27)

Features

  • Adds support for 'Sync API' - Initialize sync & sync changes endpoints (60d4198)
  • updates dev dependencies (b6b3d16)

Bug Fixes

  • fixes mapping of view content type element query (8c14c39)

12.3.0 (2022-10-05)

Features

12.2.0 (2022-09-23)

Features

  • Preservers the order of mapped linkedItems in RTE (5d9db00)
  • Updates dependencies (0a4d0bf)

12.1.0 (2022-09-01)

Features

  • Handle commas & semicolons in name resolvers (d990dcf)

12.0.2 (2022-07-21)

Bug Fixes

  • Handle '/' character in property name resolvers (9ed6c77)

12.0.1 (2022-07-15)

Bug Fixes

  • escapes property name regex to prevent unintended escaping caused by angular CLI (0913986)

12.0.0 (2022-07-14)

12.0.0-0 (2022-07-14)

11.13.0 (2022-05-23)

Features

  • Adds underscore to name resolver when it starts with a number (5a624e3)
  • Automatically removes zero width characters from name resolvers (fbf07aa)
  • convert snake case name resolver to lowercase only text (df39537)
  • Handles '&' in property name resolver (e82ae6d)
  • Handles brackets in property name resolver (946db34)
  • Improves property name resolvers by handling more special characters and unifies the regex across all name resolvers (d153e81)
  • updates dependencies (5830491)
  • updates dependencies (a373528)

Bug Fixes

  • fixes property name resolver to cover cases with mixed upper/lower case strings (66918c9)
  • Properly sets query headers (some headers were not applied which caused issues especially in combination with paging) (59af6c4)

11.12.0 (2022-04-20)

Features

  • Handles '&' in property name resolver (e82ae6d)

11.11.0 (2022-04-20)

Features

  • convert snake case name resolver to lowercase only text (df39537)
  • Handles brackets in property name resolver (946db34)

11.10.0 (2022-04-20)

Features

  • Adds underscore to name resolver when it starts with a number (5a624e3)

11.9.0 (2022-04-20)

Features

  • Automatically removes zero width characters from name resolvers (fbf07aa)

11.8.1 (2022-04-20)

Bug Fixes

  • fixes property name resolver to cover cases with mixed upper/lower case strings (66918c9)

11.8.0 (2022-04-20)

Features

  • Adds support for strongly typed taxonomy element (c3d85ee)
  • Improves property name resolvers by handling more special characters and unifies the regex across all name resolvers (d153e81)
  • updates dependencies (a373528)

11.7.0 (2022-03-28)

Features

  • Adds support for strongly typed taxonomy element (c3d85ee)
  • updates deps (d899b0b)

11.6.0 (2022-03-23)

Features

11.5.0 (2022-03-14)

11.5.0-1 (2022-03-10)

11.5.0-0 (2022-03-07)

Features

11.4.0 (2022-02-04)

Features

  • updates deps (dbb0474)
  • adds ability to configure default asset rendition

11.3.0 (2021-12-16)

Features

11.2.1 (2021-12-09)

Bug Fixes

  • use null instead of undefined for asset model properties (da7ff46)

11.2.0 (2021-12-02)

Features

  • adds absolute url to rendition record (a6a0ece)

11.1.0 (2021-11-29)

Features

11.0.0 (2021-11-16)

Features

  • renames INetworkResponse interface to IDeliveryNetworkResponse (e566537)
  • updates deps (42a6ff9)

11.0.0-11 (2021-10-27)

11.0.0-10 (2021-10-27)

Features

  • updates readme, creates base rich text resolvers and uses function to create each and every available resolver (1cf140c)

11.0.0-9 (2021-10-27)

Features

  • updates names rich text related async models (231f4f6)

11.0.0-8 (2021-10-26)

Features

  • removes remaning usage of browser API in rich text resolver (74d1922)

11.0.0-7 (2021-10-26)

Bug Fixes

  • fixes object / json resolver result (dc03d75)

11.0.0-6 (2021-10-26)

Features

  • adds experimental json / object rich text resolvers, simplifies filter classes (326dff6)
  • refactors rich text processing by separating parser & rich text resolvers (48b49da)
  • separates parser from resolvers and makes resolvers independent on parser implementation, adds experimental json / object rich text element resolvers (24082ec)
  • updates deps (f3ccfb9)

11.0.0-5 (2021-10-19)

Bug Fixes

  • fixes value type for LinkedItemsElement (b6cfc8e)

11.0.0-4 (2021-10-14)

Features

  • removes log message when content item is not in response (b60f36b)
  • use null for instead of undefined for some response models (ff27a93)

Bug Fixes

  • use null for response models (53792f1)

11.0.0-3 (2021-10-14)

⚠ BREAKING CHANGES

  • use "string" type for all "Date" properties to support more serialization scenarios

Features

  • updates deps, removes duplicate license (035335f)
  • use "string" type for all "Date" properties to support more serialization scenarios (909102f)

11.0.0-2 (2021-10-04)

Features

  • adds ability to disable mapping of content items in linked items & rich text elements (f67661c)
  • adds came case, pascal case & snake case property name resolvers (b422697)

11.0.0-1 (2021-10-01)

⚠ BREAKING CHANGES

  • makes rich text resolver generic, uninstalls unused packages, better organizes browser rich text parser code

Features

  • makes rich text resolver generic, uninstalls unused packages, better organizes browser rich text parser code (29042b8)

11.0.0-0 (2021-09-30)

⚠ BREAKING CHANGES

  • unifies contracts under a shared 'Contracts' namespace
  • unifies all response models under common 'Responses' namespace
  • converts image transformation enums (ImageFitModeEnum, ImageCompressionEnum, ImageFormatEnum) to types and removes the 'enum' suffix.
  • renames 'ImageUrlBuilder' to 'ImageTransformationUrlBuilder'
  • converts elements to types instead of interfaces (also removes the 'I' in the type names), adds 'createDeliveryClient' factory function, improves custom element sample
  • renames 'IKontentNetworkResponse' and 'IGroupedKontentNetworkResponse' interfaces to 'INetworkResponse' and 'IGroupedNetworkResponse'
  • removes query config from mapping service as its no longer necessary due to rich text resolver being separated
  • refactors rich text resolver, removes parse5 and default html resolver for node, creates new html resolver for use in browsers and export it with the library
  • removes 'itemCodenames' property from LinkedItemsElement because this data is already available in the value property
  • globalQueryConfig configuration option was renamed to defaultQueryConfig
  • removes _raw properties from content item & element to reduce the size of mapped response & to avoid data duplication
  • uses interface for all remaining models & responses
  • uses interfaces instead of classes for all responses
  • refactors element models by using interfaces instead of classes, changes the ElementResolver to resolve only value instead of the whole custom element
  • removes ItemResolver, refactors ContentItem from strongly types class to interface (removes ability to define resolvers on the class level)
  • moves elements to 'elements' property within the content item (they were on the content item previously), removes property mapping with reflect metadata, removes collision resolver
  • introduces new "IKontentNetworkResponse" model that wraps responses with network related data and separates response specific data for improved mapping of stored json data
  • introduces BaseListingQuery for all endpoint with pagination, removes itemsFeedAll method & query, refactors queries to improve their readability, adds missing filter methods, unifies query config and some other minor improvements & changes
  • renames withUrl query extension method to withCustomUrl
  • renames query extension method 'withParameter' to 'withCustomParameter'. Adds new 'withParameter' method which takes IQueryParameter object similarly as 'withParameters' does for array parameters
  • makes SortOrder type instead of enum
  • updates kontent-core, removes rxjs from repository in favor of Promises and async based approach
  • updates build process (puts all output to "dist" folder), consolidates tests, updates tsconfig

Features

  • globalQueryConfig configuration option was renamed to defaultQueryConfig (8817105)
  • adds 'createUrlBuilder' factory function (54b5085)
  • adds 'withContinuationToken' extension method to all listing queries (a28ddb3)
  • adds 'withHeader' query extension method, improves docs of some extension methods (20b9334)
  • adds ability to define number of pages to fetch in 'toAllPromise' method (d5d8c2c)
  • adds ability to map raw json data with 'map' query extension method (dab3618)
  • adds network response tests (0e8b690)
  • adds support for 'workflow_step' in content item system attributes (fixes https://github.com/kontent-ai/delivery-sdk-js/issues/309) (ad2d965)
  • adds support for async browser rich text resolver (ece99b7)
  • converts elements to types instead of interfaces (also removes the 'I' in the type names), adds 'createDeliveryClient' factory function, improves custom element sample (2ccb97c)
  • converts image transformation enums (ImageFitModeEnum, ImageCompressionEnum, ImageFormatEnum) to types and removes the 'enum' suffix. (d44573a)
  • improves typings of raw response data by providing contract types for each query (be654f1)
  • introduces BaseListingQuery for all endpoint with pagination, removes itemsFeedAll method & query, refactors queries to improve their readability, adds missing filter methods, unifies query config and some other minor improvements & changes (7c68b8f)
  • introduces new "IKontentNetworkResponse" model that wraps responses with network related data and separates response specific data for improved mapping of stored json data (ba4c265)
  • makes SortOrder type instead of enum (1d61369)
  • moves elements to 'elements' property within the content item (they were on the content item previously), removes property mapping with reflect metadata, removes collision resolver (8f6ed55)
  • refactors element models by using interfaces instead of classes, changes the ElementResolver to resolve only value instead of the whole custom element (c3fbd51)
  • refactors internal use of headers (stores headers in a single location) (9c0fe73)
  • refactors rich text resolver, removes parse5 and default html resolver for node, creates new html resolver for use in browsers and export it with the library (04633a9)
  • removes _raw properties from content item & element to reduce the size of mapped response & to avoid data duplication (5c4eb8c)
  • removes 'itemCodenames' property from LinkedItemsElement because this data is already available in the value property (acefbe8)
  • removes ItemResolver, refactors ContentItem from strongly types class to interface (removes ability to define resolvers on the class level) (039ed29)
  • removes query config from mapping service as its no longer necessary due to rich text resolver being separated (748b2f7)
  • renames 'IKontentNetworkResponse' and 'IGroupedKontentNetworkResponse' interfaces to 'INetworkResponse' and 'IGroupedNetworkResponse' (9000c14)
  • renames 'ImageUrlBuilder' to 'ImageTransformationUrlBuilder' (8124cfe)
  • renames query extension method 'withParameter' to 'withCustomParameter'. Adds new 'withParameter' method which takes IQueryParameter object similarly as 'withParameters' does for array parameters (a518694)
  • renames withUrl query extension method to withCustomUrl (dbe6b77)
  • unifies all response models under common 'Responses' namespace (ad28631)
  • unifies contracts under a shared 'Contracts' namespace (41ddd98)
  • updates build process (puts all output to "dist" folder), consolidates tests, updates tsconfig (c2946f7)
  • updates deps (a18d770)
  • updates deps (320d2df)
  • updates deps (67da9df)
  • updates kontent-core, removes rxjs from repository in favor of Promises and async based approach (b213a7d)
  • uses interface for all remaining models & responses (ad7b18d)
  • uses interfaces instead of classes for all responses (2cd8cb2)

10.4.1 (2021-03-31)

10.4.0 (2021-03-18)

Features

  • adds resolved attribute to BrowserRichTextParser, adds index to every resolved linked item & component within rich text element values (b81d523)
  • use switchMap instead of deprecated flatMap operator (59bd752)

10.3.0 (2021-02-05)

Features

10.2.0 (2021-01-08)

Features

Bug Fixes

  • updates internal types of parse5 parser adapter (83109f7)

10.1.0 (2020-11-26)

Features

  • adds support for collections
  • updates all dependencies, uses axios models directly for request interceptors (5aa5f8b)

10.0.0 (2020-08-25)

⚠ BREAKING CHANGES

Features

Bug Fixes

  • fixes url resolving test for node.js (212d343)

9.2.1 (2020-08-11)

Bug Fixes

9.2.0 (2020-07-30)

Features

  • updates dependencies, moves error handling logic from core package to sdk + fixes error mapping after recent error response change which now allows null in request_id property (a11e745)

Bug Fixes

9.1.1 (2020-04-02)

Bug Fixes

  • fixes missing attributes in parse5 resolved links with custom html (2e2f8c1)

9.1.0 (2020-03-26)

Features

  • exposes richTextParserAdapter via config (62659a6)

Bug Fixes

9.0.0 (2020-01-20)

⚠ BREAKING CHANGES

  • updates deps, refactors retry-strategy which enables specifying either maximum number of attemps or wait time and allows retry of any error even when response is not received (e.g. timeout which could not be retried previously)

Features

  • distributes library in esNext format (bd9ea6f)
  • refactors item mappers and adds full mapping support to items-feed endpoints (e.g. rich text resolver, url slug resolver, image resolver ..) (6e30485)
  • updates deps, refactors retry-strategy which enables specifying either maximum number of attemps or wait time and allows retry of any error even when response is not received (e.g. timeout which could not be retried previously) (b7cf414)

8.2.0 (2019-11-25)

Features

Bug Fixes

8.1.0 (2019-11-18)

Features

  • adds support for 'includeTotalCount| parameter (c39a301)

Bug Fixes

  • updates kontent-core package which fixes http retry requests (53a4318)

8.0.0 (2019-10-25)

⚠ BREAKING CHANGES

  • Updates @kentico/kontent-core to v4 and uses new and improved retry strategy. 'retryAttempts' configuration option was removed in favor of 'retryStrategy' object.

Features

  • adds 'itemsFeedAll' method to get all items from a project. This method may execute multiple HTTP requests. Reworks base responses & debug to allow different debug types per response. (72e03fd)
  • adds support for 'items-feed' endpoint (29913c9)
  • Updates @kentico/kontent-core to v4 and uses new and improved retry strategy. 'retryAttempts' configuration option was removed in favor of 'retryStrategy' object. (e2abd02)

Bug Fixes

  • prepares instances of all items before resolving occurs to prevent some items from being skipped (5559cb6)

7.2.0 (2019-10-21)

Features

7.1.0 (2019-10-14)

7.1.0 (2019-10-14)

Features

  • adds hasStaleContent property to all responses and uses new BaseDeliveryResponse base class (3dc5046)

7.0.1 (2019-10-14)