Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

contentful

Package Overview
Dependencies
Maintainers
3
Versions
452
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

contentful - npm Package Compare versions

Comparing version 10.15.1 to 10.15.2

dist/contentful.cjs

2

dist/types/contentful.d.ts

@@ -6,3 +6,3 @@ /**

import type { AxiosAdapter, AxiosRequestConfig, AxiosResponse } from 'axios';
import { ContentfulClientApi } from './types';
import type { ContentfulClientApi } from './types/client.js';
/**

@@ -9,0 +9,0 @@ * @category Client

@@ -6,5 +6,5 @@ /**

import { AxiosInstance } from 'contentful-sdk-core';
import { GetGlobalOptions } from './create-global-options';
import { ContentfulClientApi } from './types';
import { ChainOptions } from './utils/client-helpers';
import { GetGlobalOptions } from './create-global-options.js';
import type { ContentfulClientApi } from './types/index.js';
import { ChainOptions } from './utils/client-helpers.js';
export interface CreateContentfulApiParams {

@@ -11,0 +11,0 @@ http: AxiosInstance;

@@ -1,6 +0,6 @@

export * from './contentful';
export * from './create-global-options';
export * from './mixins/stringify-safe';
export * from './utils/normalize-select';
export * from './utils/resolve-circular';
export * from './types';
export * from './contentful.js';
export * from './create-global-options.js';
export * from './mixins/stringify-safe.js';
export * from './utils/normalize-select.js';
export * from './utils/resolve-circular.js';
export * from './types/index.js';

@@ -1,3 +0,3 @@

import { CreateContentfulApiParams } from './create-contentful-api';
import { ContentfulClientApi } from './types';
import { CreateContentfulApiParams } from './create-contentful-api.js';
import type { ContentfulClientApi } from './types/index.js';
export declare const makeClient: ({ http, getGlobalOptions, }: CreateContentfulApiParams) => ContentfulClientApi<undefined>;
import { AxiosInstance } from 'contentful-sdk-core';
import { SyncCollection, SyncOptions, SyncQuery, LocaleCode, EntrySkeletonType } from './types';
import { ChainOptions, ModifiersFromOptions } from './utils/client-helpers';
import type { SyncCollection, SyncOptions, SyncQuery, LocaleCode, EntrySkeletonType } from './types/index.js';
import { ChainOptions, ModifiersFromOptions } from './utils/client-helpers.js';
/**

@@ -5,0 +5,0 @@ * Retrieves all the available pages for a sync operation

@@ -1,15 +0,15 @@

export * from './asset';
export * from './asset-key';
export { AddChainModifier, ChainModifiers, ContentfulClientApi } from './client';
export * from './collection';
export * from './content-type';
export * from './entry';
export * from './link';
export * from './locale';
export * from './metadata';
export * from './query';
export * from './resource-link';
export * from './space';
export * from './sync';
export * from './sys';
export * from './tag';
export * from './asset.js';
export * from './asset-key.js';
export { AddChainModifier, ChainModifiers, ContentfulClientApi } from './client.js';
export * from './collection.js';
export * from './content-type.js';
export * from './entry.js';
export * from './link.js';
export * from './locale.js';
export * from './metadata.js';
export * from './query/index.js';
export * from './resource-link.js';
export * from './space.js';
export * from './sync.js';
export * from './sys.js';
export * from './tag.js';

@@ -1,12 +0,12 @@

export { type FieldsType, EntrySkeletonType, type ConditionalFixedQueries, type ConditionalListQueries, } from './util';
export * from './equality';
export * from './existence';
export * from './location';
export * from './order';
export * from './query';
export * from './range';
export * from './reference';
export * from './search';
export * from './select';
export * from './set';
export * from './subset';
export { type FieldsType, EntrySkeletonType, type ConditionalFixedQueries, type ConditionalListQueries, } from './util.js';
export * from './equality.js';
export * from './existence.js';
export * from './location.js';
export * from './order.js';
export * from './query.js';
export * from './range.js';
export * from './reference.js';
export * from './search.js';
export * from './select.js';
export * from './set.js';
export * from './subset.js';
{
"name": "contentful",
"description": "Client for Contentful's Content Delivery API",
"version": "10.15.1",
"version": "10.15.2",
"homepage": "https://www.contentful.com/developers/documentation/content-delivery-api/",
"main": "./dist/contentful.node.min.js",
"browser": "./dist/contentful.browser.min.js",
"types": "./dist/types/index.d.ts",
"type": "module",
"exports": {
".": {
"import": "./dist/esm/index.js",
"require": "./dist/contentful.cjs",
"types": "./dist/types/index.d.ts"
}
},
"main": "./dist/esm/index.js",
"types": "dist/types/index.d.ts",
"engines": {

@@ -46,10 +53,11 @@ "node": ">=18"

"clean": "rimraf dist",
"build": "npm run clean && npm run build:dev && npm run build:prod",
"build:dev": "NODE_OPTIONS=--openssl-legacy-provider NODE_ENV=development webpack",
"build:prod": "NODE_OPTIONS=--openssl-legacy-provider NODE_ENV=production webpack",
"build:types": "tsc --declaration --emitDeclarationOnly",
"postbuild": "npm run check:browser && npm run check:browser-min && npm run check:node && npm run test:demo-projects",
"check:browser": "es-check es2017 --module ./dist/contentful.browser.js",
"check:browser-min": "es-check es2017 --module ./dist/contentful.browser.min.js",
"check:node": "es-check es2017 ./dist/contentful.node.js",
"build": "npm run clean && npm run build:esm && npm run build:bundles && rm -rf dist/esm-raw",
"build:esm": "tsc",
"build:bundles": "NODE_ENV=production rollup -c",
"postbuild": "npm run check && npm run test:demo-projects",
"check": "npm run check:cjs && npm run check:esm && npm run check:browser && npm run check:browser-min",
"check:browser": "es-check es2018 ./dist/contentful.browser.js",
"check:browser-min": "es-check es2018 ./dist/contentful.browser.min.js",
"check:cjs": "es-check es2017 './dist/contentful.cjs'",
"check:esm": "es-check es2017 --module './dist/esm/*.js'",
"docs:build": "typedoc --options typedoc.json",

@@ -63,14 +71,16 @@ "docs:watch": "npm run docs:build -- --watch",

"test": "npm run test:unit && npm run test:integration && npm run lint && npm run test:types",
"test:unit": "jest ./test/unit",
"test:unit:watch": "jest ./test/unit --watch",
"test:integration": "jest ./test/integration",
"test:unit": "vitest --run ./test/unit",
"test:unit:watch": "vitest ./test/unit",
"test:integration": "vitest --run ./test/integration",
"test:integration:watch": "vitest ./test/integration",
"test:size": "bundlesize",
"test:demo-projects": "npm run test:demo-node && npm run test:demo-browser",
"test:demo-node": "rimraf ./test/output-integration/node/node-modules && npm --prefix ./test/output-integration/node ci && jest ./test/output-integration/node",
"test:demo-node": "rimraf ./test/output-integration/node/node-modules && npm --prefix ./test/output-integration/node ci && vitest --run ./test/output-integration/node",
"test:demo-browser": "rimraf ./test/output-integration/browser/node-modules && npm --prefix ./test/output-integration/browser ci && npm --prefix ./test/output-integration/browser run test",
"test:types": "./node_modules/.bin/tsd",
"test:prepush": "npm run build && npm run test:unit && npm run test:size",
"test:types": "tsd",
"test:prepush": "npm run build && npm run test:unit && npm run test:types",
"prepublishOnly": "export PUBLISH_RUN=true && npm run build && unset PUBLISH_RUN",
"postpublish": "npm run docs:publish && npm run clean",
"semantic-release": "semantic-release",
"prepare": "husky",
"precommit": "npm run lint && npm run prettier:check",

@@ -80,6 +90,6 @@ "prepush": "npm run test:prepush"

"dependencies": {
"@contentful/rich-text-types": "^16.6.1",
"contentful-resolve-response": "^1.9.0",
"@contentful/content-source-maps": "^0.11.0",
"@contentful/rich-text-types": "^16.0.2",
"axios": "^1.7.4",
"contentful-resolve-response": "^1.9.0",
"contentful-sdk-core": "^8.3.1",

@@ -90,43 +100,40 @@ "json-stringify-safe": "^5.0.1",

"devDependencies": {
"@babel/preset-env": "^7.24.0",
"@babel/plugin-transform-runtime": "^7.24.7",
"@babel/preset-env": "^7.24.3",
"@optimize-lodash/rollup-plugin": "^4.0.4",
"@rollup/plugin-alias": "^5.1.0",
"@rollup/plugin-babel": "^6.0.4",
"@rollup/plugin-commonjs": "^26.0.1",
"@rollup/plugin-json": "^6.1.0",
"@rollup/plugin-node-resolve": "^15.2.3",
"@rollup/plugin-replace": "^5.0.5",
"@rollup/plugin-terser": "^0.4.4",
"@semantic-release/changelog": "^6.0.1",
"@types/jest": "^27.0.2",
"@types/json-stringify-safe": "^5.0.0",
"@typescript-eslint/eslint-plugin": "^6.13.0",
"@typescript-eslint/parser": "^6.13.0",
"babel-loader": "^9.1.3",
"@typescript-eslint/eslint-plugin": "^7.3.1",
"@typescript-eslint/parser": "^7.3.1",
"bundlesize": "^0.18.1",
"contentful-sdk-jsdoc": "^3.0.0",
"core-js": "^3.2.1",
"cz-conventional-changelog": "^3.3.0",
"es-check": "^7.0.0",
"eslint": "^7.2.0",
"eslint": "^8.57.0",
"eslint-config-prettier": "^9.0.0",
"eslint-config-standard": "^16.0.0",
"eslint-config-standard": "^17.1.0",
"eslint-plugin-import": "^2.9.0",
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-promise": "^5.2.0",
"eslint-plugin-promise": "^6.1.1",
"eslint-plugin-standard": "^5.0.0",
"express": "^4.15.4",
"fast-copy": "^2.1.7",
"husky": "^8.0.1",
"in-publish": "^2.0.0",
"istanbul": "^1.0.0-alpha.2",
"jest": "^27.5.1",
"jest-when": "^3.0.1",
"json": "^11.0.0",
"json-pointer": "^0.6.2",
"mkdirp": "^3.0.0",
"nodemon": "^3.0.1",
"eslint-plugin-vitest-globals": "^1.5.0",
"fast-copy": "^3.0.2",
"husky": "^9.0.11",
"prettier": "^3.1.0",
"process": "^0.11.10",
"rimraf": "^5.0.0",
"rollup": "^4.13.0",
"rollup-plugin-visualizer": "^5.12.0",
"semantic-release": "^22.0.8",
"ts-jest": "^27.1.3",
"ts-loader": "^9.4.1",
"tsd": "^0.31.0",
"tslib": "^2.0.3",
"typedoc": "^0.25.0",
"typescript": "^4.8.4",
"webpack": "^5.67.0",
"webpack-cli": "^5.0.0"
"typedoc": "^0.26.4",
"typescript": "^5.5.3",
"vitest": "^2.0.2"
},

@@ -140,16 +147,8 @@ "config": {

{
"path": "./dist/contentful.node.js",
"maxSize": "250Kb"
},
{
"path": "./dist/contentful.node.min.js",
"maxSize": "120Kb"
},
{
"path": "./dist/contentful.browser.js",
"maxSize": "171Kb"
"maxSize": "85Kb"
},
{
"path": "./dist/contentful.browser.min.js",
"maxSize": "128Kb"
"maxSize": "45Kb"
}

@@ -156,0 +155,0 @@ ],

@@ -61,29 +61,36 @@ <!-- shared header START -->

- [contentful.js - Contentful JavaScript Delivery library](#contentfuljs---contentful-javascript-delivery-library)
- [Core Features](#core-features)
- [Supported browsers and Node.js versions](#supported-browsers-and-nodejs-versions)
- [Getting started](#getting-started)
- [Installation](#installation)
- [Using it directly in the browser](#using-it-directly-in-the-browser)
- [Legacy browsers:](#legacy-browsers)
- [React Native & Server Side Rendering:](#react-native--server-side-rendering)
- [Your first request](#your-first-request)
- [Using this library with the Preview API](#using-this-library-with-the-preview-api)
- [Authentication](#authentication)
- [Documentation & References](#documentation--references)
- [Configuration](#configuration)
- [Client chain modifiers](#client-chain-modifiers)
- [Reference documentation](#reference-documentation)
- [Tutorials & other resources](#tutorials--other-resources)
- [Troubleshooting](#troubleshooting)
- [Typscript](#typescript)
- [Advanced Concepts](https://github.com/contentful/contentful.js/blob/master/ADVANCED.md)
- [Migration](https://github.com/contentful/contentful.js/blob/master/MIGRATION.md)
- [Reach out to us](#reach-out-to-us)
- [You have questions about how to use this library?](#you-have-questions-about-how-to-use-this-library)
- [You found a bug or want to propose a feature?](#you-found-a-bug-or-want-to-propose-a-feature)
- [You need to share confidential information or have other questions?](#you-need-to-share-confidential-information-or-have-other-questions)
- [Get involved](#get-involved)
- [License](#license)
- [Code of Conduct](#code-of-conduct)
- [Introduction](#introduction)
- [Core Features](#core-features)
- [Supported browsers and Node.js versions](#supported-browsers-and-nodejs-versions)
- [Getting started](#getting-started)
- [Installation](#installation)
- [Using in Legacy Environments Without ESM/Import Support](#using-in-legacy-environments-without-esmimport-support)
- [Using it directly in the browser](#using-it-directly-in-the-browser)
- [Your first request](#your-first-request)
- [Using this library with the Preview API](#using-this-library-with-the-preview-api)
- [Authentication](#authentication)
- [Documentation \& References](#documentation--references)
- [Configuration](#configuration)
- [Request configuration options](#request-configuration-options)
- [Response configuration options](#response-configuration-options)
- [Client chain modifiers](#client-chain-modifiers)
- [Entries](#entries)
- [Example](#example)
- [Assets](#assets)
- [Example](#example-1)
- [Sync](#sync)
- [Example](#example-2)
- [Reference documentation](#reference-documentation)
- [Tutorials \& other resources](#tutorials--other-resources)
- [Troubleshooting](#troubleshooting)
- [TypeScript](#typescript)
- [Advanced concepts](#advanced-concepts)
- [Migration](#migration)
- [Reach out to us](#reach-out-to-us)
- [You have questions about how to use this library?](#you-have-questions-about-how-to-use-this-library)
- [You found a bug or want to propose a feature?](#you-found-a-bug-or-want-to-propose-a-feature)
- [You need to share confidential information or have other questions?](#you-need-to-share-confidential-information-or-have-other-questions)
- [Get involved](#get-involved)
- [License](#license)
- [Code of Conduct](#code-of-conduct)

@@ -110,12 +117,14 @@ <!-- /TOC -->

- node.js (LTS)
- React Native (Metro bundler)
> See list of min supported browser version here [@contentful/browserslist-config
> ](https://github.com/contentful/browserslist-config/blob/master/index.js)
> For the minimum supported browser versions, refer to the [package.json of this library.](https://github.com/contentful/contentful.js/blob/master/package.json#L12)
The default export is an `es9` compliant module. In order to import the `commonJS` bundle, please use:
To ensure compatibility across various JavaScript environments, this library is built as an ECMAScript Module (ESM) by default, using the `"type": "module"` declaration in `package.json`.
```js
const contentful = require('contentful/contentful.node')
```
We also offer a bundle for the legacy CommonJS (CJS) require syntax, allowing usage in environments that do not support ESM.
Additionally, there is a bundle available for direct usage within browsers.
For more details on the different variants of this library, see [Installation](#installation).
## Getting started

@@ -137,2 +146,22 @@

In a modern environment, you can import this library using:
```js
import * as contentful from 'contentful'
```
#### Using in Legacy Environments Without ESM/Import Support
Typically, your system will default to our CommonJS export when you use the require syntax:
```js
const contentful = require('contentful')
```
If this does not work, you can directly require the CJS-compatible code:
```js
const contentful = require('contentful/dist/contentful.cjs')
```
#### Using it directly in the browser

@@ -163,3 +192,3 @@

```js
const contentful = require('contentful')
import * as contentful from "contentful"
const client = contentful.createClient({

@@ -185,3 +214,3 @@ // This is the space ID. A space is like a project folder in Contentful terms

```js
const contentful = require('contentful')
import * as contentful from "contentful"
const client = contentful.createClient({

@@ -233,22 +262,22 @@ space: 'developer_bookshelf',

| Name | Default | Description |
| ---------------- | --------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `accessToken` | | **Required**. Your CDA access token. |
| `space` | | **Required**. Your Space ID. |
| `environment` | `'master'` | Set the environment that the API key has access to. |
| `host` | `'cdn.contentful.com'` | Set the host used to build the request URI's. |
| `basePath` | `''` | This path gets appended to the host to allow request urls like `https://gateway.example.com/contentful/` for custom gateways/proxies. |
| `httpAgent` | `undefined` | Custom agent to perform HTTP requests. Find further information in the [axios request config documentation](https://github.com/axios/axios#request-config). |
| `httpsAgent` | `undefined` | Custom agent to perform HTTPS requests. Find further information in the [axios request config documentation](https://github.com/axios/axios#request-config). |
| `adapter` | `undefined` | Custom adapter to handle making the requests. Find further information in the [axios request config documentation](https://github.com/axios/axios#request-config). |
| Name | Default | Description |
| ---------------- | --------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `accessToken` | | **Required**. Your CDA access token. |
| `space` | | **Required**. Your Space ID. |
| `environment` | `'master'` | Set the environment that the API key has access to. |
| `host` | `'cdn.contentful.com'` | Set the host used to build the request URI's. |
| `basePath` | `''` | This path gets appended to the host to allow request urls like `https://gateway.example.com/contentful/` for custom gateways/proxies. |
| `httpAgent` | `undefined` | Custom agent to perform HTTP requests. Find further information in the [axios request config documentation](https://github.com/axios/axios#request-config). |
| `httpsAgent` | `undefined` | Custom agent to perform HTTPS requests. Find further information in the [axios request config documentation](https://github.com/axios/axios#request-config). |
| `adapter` | `undefined` | Custom adapter to handle making the requests. Find further information in the [axios request config documentation](https://github.com/axios/axios#request-config). |
| `headers` | `{}` | Additional headers to attach to the requests. We add/overwrite the following headers: <ul><li><b>Content-Type:</b> `application/vnd.contentful.delivery.v1+json`</li><li><b>X-Contentful-User-Agent:</b> `sdk contentful.js/1.2.3; platform node.js/1.2.3; os macOS/1.2.3` (Automatically generated)</li></ul> |
| `proxy` | `undefined` | Axios proxy configuration. See the [axios request config documentation](https://github.com/axios/axios#request-config) for further information about the supported values.  |
| `retryOnError` | `true` | By default, this library is retrying requests which resulted in a 500 server error and 429 rate limit response. Set this to `false` to disable this behavior. |
| `application` | `undefined` | Application name and version e.g myApp/version. |
| `integration` | `undefined` | Integration name and version e.g react/version. |
| `timeout` | `30000` | in milliseconds - connection timeout. |
| `retryLimit` | `5` | Optional number of retries before failure. |
| `logHandler` | `function (level, data) {}` | Errors and warnings will be logged by default to the node or browser console. Pass your own log handler to intercept here and handle errors, warnings and info on your own. |
| `requestLogger` | `function (config) {}` | Interceptor called on every request. Takes Axios request config as an arg. |
| `responseLogger` | `function (response) {}` | Interceptor called on every response. Takes Axios response object as an arg. |
| `proxy` | `undefined` | Axios proxy configuration. See the [axios request config documentation](https://github.com/axios/axios#request-config) for further information about the supported values.  |
| `retryOnError` | `true` | By default, this library is retrying requests which resulted in a 500 server error and 429 rate limit response. Set this to `false` to disable this behavior. |
| `application` | `undefined` | Application name and version e.g myApp/version. |
| `integration` | `undefined` | Integration name and version e.g react/version. |
| `timeout` | `30000` | in milliseconds - connection timeout. |
| `retryLimit` | `5` | Optional number of retries before failure. |
| `logHandler` | `function (level, data) {}` | Errors and warnings will be logged by default to the node or browser console. Pass your own log handler to intercept here and handle errors, warnings and info on your own. |
| `requestLogger` | `function (config) {}` | Interceptor called on every request. Takes Axios request config as an arg. |
| `responseLogger` | `function (response) {}` | Interceptor called on every response. Takes Axios response object as an arg. |

@@ -255,0 +284,0 @@ ##### Response configuration options

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc