Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
2ac1bb2
chore: update to version 5.0.0 with cache persistence as a separate p…
nadeem-cs Feb 4, 2026
1aed86f
chore: migrate build system from tsup to rollup
nadeem-cs Feb 4, 2026
a1746df
chore: update configuration and scripts for improved testing and buil…
nadeem-cs Feb 4, 2026
a4f5485
refactor: reorganize file structure and enhance caching functionality
nadeem-cs Feb 5, 2026
5860b86
Fix locale error status code assertions to support 400 and 141
AniketDev7 Feb 9, 2026
f971010
Merge pull request #311 from contentstack/fix/locale-error-status-codes
AniketDev7 Feb 9, 2026
26e65aa
Merge pull request #313 from contentstack/main
harshithad0703 Feb 9, 2026
4d390e3
Merge branch 'development' into version5
nadeem-cs Feb 10, 2026
7d28cdc
Merge pull request #306 from contentstack/version5
nadeem-cs Feb 10, 2026
c0d20a2
Merge pull request #316 from contentstack/main
harshithad0703 Feb 13, 2026
f1fd787
Merge branch 'staging' into fix/dx-4340-Sync-API-returns-non-Axios-re…
harshithad0703 Feb 13, 2026
163c327
fix: resolve Sync API non-Axios response issue and update types for s…
harshithad0703 Feb 13, 2026
589b5db
refactor: update test assertions to use 'items' instead of 'entries' …
harshithad0703 Feb 13, 2026
e2520ed
fix: correct sync token assertions and improve pagination handling in…
harshithad0703 Feb 13, 2026
58ad95c
Merge remote-tracking branch 'origin/development' into staging-confli…
sunil-lakshman Feb 13, 2026
8d31ee9
Merge pull request #319 from contentstack/staging-conflict-fix
sunil-lakshman Feb 13, 2026
d2fb213
Merge remote-tracking branch 'origin/development' into staging-confli…
sunil-lakshman Feb 13, 2026
24504f0
Merge pull request #320 from contentstack/staging-conflict-fix1
sunil-lakshman Feb 13, 2026
358d8db
Merge pull request #322 from contentstack/development
naman-contentstack Feb 13, 2026
e38e0ee
chore: downgrade package version from 5.0.1 to 5.0.0 in package.json
harshithad0703 Feb 13, 2026
1cf341e
Merge pull request #317 from contentstack/fix/dx-4340-Sync-API-return…
harshithad0703 Feb 13, 2026
9cc5fea
Merge pull request #324 from contentstack/development
harshithad0703 Feb 13, 2026
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
7 changes: 6 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ test-results/
src/**/*.js
src/**/*.js.map

# Compiled test artifacts (use .ts source only)
test/api/**/*.js
test/api/**/*.js.map

# Browser test bundle (generated)
test/e2e/sdk-browser-bundle.js
test/e2e/sdk-browser-bundle.js.map
Expand All @@ -42,4 +46,5 @@ test/docs/*.js
test/docs/*.mjs
test/docs/sanity-report*
*.log
.nx/
.nx/
delivery-sdk-persistence/
42 changes: 20 additions & 22 deletions .talismanrc
Original file line number Diff line number Diff line change
@@ -1,4 +1,14 @@
fileignoreconfig:
- filename: README.md
checksum: b40240271f930e1c0db9bbcf78a55bf0d52d6caf0eb265eae94d1a2aecf442c5
- filename: test/unit/error-messages.spec.ts
checksum: 186390727b2488317c49f22955ade58b454d4c00c6b850bbb0617c30c59f8255
- filename: src/common/types.ts
checksum: 0466775043773ec966f10bac2eeed812274748fc275a1017ad51295dff5c58ca
- filename: test/unit/contentstack.spec.ts
checksum: 8f560efd9fba6e04682899eff3cc448d22c38019eac0a5ffcab35ba59f81da2c
- filename: test/unit/cache.spec.ts
checksum: a9bf179485c09e3821d78588a6bd2a57a70b68dd05948f7187c73d05b846b651
- filename: test/browser/import.spec.ts
checksum: 2e9a157e28b0ce71c4b6422c6b457996a2e6785a1ef591c8bb35276b3471a5d0
- filename: scripts/test-bundlers.js
Expand All @@ -13,21 +23,15 @@ fileignoreconfig:
checksum: 6646595d48bfaec3d9de111b22b36cf0925b33e18df55b068181c0bb81c1862b
- filename: test/browser/real-api-calls.spec.ts
checksum: 514930cdde28cdc8b37ab054031260d5703dc8bdf777906dd5f9baa270ab7c3a
- filename: package-lock.json
checksum: e0a6679bfc6556fb7a8424c3f8eb0cec62f2cc871ad544f691fa064ddec30db7
- filename: test/unit/utils.spec.ts
checksum: a491df0a19c336ff5b18450fb23e26676a1798222100c946150e7a1b6504d953
- filename: test/unit/contentstack.spec.ts
checksum: d5b99c01459ab8bc597baaa9e6cc4aa91ac6d9bf78af08e1d0220d0c5db3d0b3
- filename: test/unit/query-optimization-comprehensive.spec.ts
checksum: f5aaf6c784d7c101a05ca513c584bbd6e95f963d1e42779f2596050d9bcbac96
- filename: src/lib/entries.ts
- filename: src/entries/entries.ts
checksum: f6a19da15baed75062ad0cc599573ed08926e28fffe3f6e4890a0efb4d58c910
- filename: src/lib/cache.ts
- filename: src/cache/cache.ts
checksum: d8d32089b8a4b247e4ba71c22b56cbb0a54440ebf35b102af222eb8032919f02
- filename: test/unit/cache.spec.ts
checksum: e96f913a466a1f4d55a422e7032fc2c06eeed5fea86cdcc86a05fbe3eba29b7a
- filename: src/lib/query.ts
- filename: src/query/query.ts
checksum: 073c47e46755eb79d1d7e9fcaf2864296a218bf650888dd37c42480cce7df379
- filename: test/api/retry-integration.spec.ts
checksum: dc07b0a8111fd8e155b99f56c31ccdddd4f46c86f1b162b17d73e15dfed8e3c8
Expand All @@ -36,32 +40,26 @@ fileignoreconfig:
- filename: package-lock.json
checksum: 993afd503e9f5d399fac30ae230cb47538cec2c61c5364e88be72726fb723dda
ignore_detectors: [ base64, filecontent ]
- filename: src/lib/global-field.ts
- filename: src/global-field/global-field.ts
checksum: 70b9652bcba16ddc4d853ac212ad909a8ecfc76f491c55a05e4e3cdf9ce476b5
- filename: src/lib/content-type.ts
- filename: src/content-type/content-type.ts
checksum: 1dc0fa53ae209efb67d68a01493822e9dec560799f8309329213dae69459655f
- filename: src/lib/stack.ts
- filename: src/stack/stack.ts
checksum: 145dd6add876a771a9a6ba024f57ef2c4b46a911fe1bf3885a69cf1f6c9dd72d
- filename: src/lib/entry.ts
- filename: src/entries/entry.ts
checksum: 1c64ccf19226873d068d6896028bfb74546c1cfd993779515bccfcc747180ca0
- filename: src/lib/error-messages.ts
- filename: src/common/error-messages.ts
checksum: 3b960af19f3ba302522e912616b147b11d63dfe3f7ad2e0cf2de807815ee236a
- filename: src/lib/global-field-query.ts
- filename: src/query/global-field-query.ts
checksum: 824c54061b80236380e776640e7f52f45164230bcc0ee88de302b30e9f83297f
- filename: src/lib/base-query.ts
- filename: src/query/base-query.ts
checksum: 8d67435121581d43ba9c5f544daf30a0579b7faa7c8661000d8d37ddfc172112
- filename: test/unit/base-query.spec.ts
checksum: ceaceb1d65965b151edc9fc11d5a226460328b1913319994df51ca1b453cd6af
- filename: src/lib/entries.ts
checksum: 3ffe426234ef710d0fcfd8e41ca57f61ce6bc44298ee7dde6f4530fa3c16d2ee
- filename: test/unit/error-messages.spec.ts
checksum: b64be136b19890aa9e9000bac7df6eb1188828ee4b740d5c756396699716c428
- filename: test/api/modular-blocks.spec.ts
checksum: 1e536b0409f05f2d5c1d6e87b0ec4bda2c3fde9bc4ff331406f33464a26cff55
- filename: test/unit/centralized-error-handling.spec.ts
checksum: 66a5eb520414bd71da331338bfb4faa2fc9f233eadf0eb18ddd7915db6849238
- filename: src/lib/query.ts
checksum: f7200cb6e3b9ff681439482faaf882781dfb5f6ab6fefd4c98203ba8bf30d5e6
- filename: test/api/base-query-casting.specs.ts
checksum: 9185df498914e2966d78d9d216acaaa910d43cd7ac9a5e9a26e7241ac9edc9b5
- filename: test/reporting/generate-unified-report.js
Expand Down
13 changes: 12 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,20 @@
### Version: 5.0.0
#### Date: Feb-16-2026
Breaking: Cache persistence is now a separate plugin. When using a cache policy other than `IGNORE_CACHE`, you must pass `cacheOptions.persistenceStore`. Install `@contentstack/persistence-plugin` and use `new PersistenceStore({ ... })` as the store. The SDK no longer bundles persistence code or accepts `storeType` in `cacheOptions`.
Enhancement: SDK defines only the `PersistenceStore` interface (getItem/setItem); full implementation lives in the plugin for a lighter core package.
Fix: Sync API returns non-Axios response causing undefined data and recursive sync failure

### Version: 4.11.2
#### Date: feb-11-2026
Fix: JS core & axios version bump


### Version: 4.11.2
#### Date: feb-11-2026
Fix: JS core & axios version bump

### Version: 4.11.1
#### Date: feb-09-2026
#### Date: Feb-09-2026
Fix: Fix security issues

### Version: 4.11.0
Expand Down
33 changes: 31 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ The Typescript SDK can also be used to create Node.js and React native applicati

### Prerequisite

You need Node.js version 4.4.7 or later installed to use the Contentstack JavaScript SDK.
You need Node.js version 18 or later installed to use the Contentstack TypeScript SDK.

### Setup and Installation

Expand Down Expand Up @@ -189,6 +189,35 @@ const pagedResult = await query

```

### Caching

To use cache policies (`CACHE_THEN_NETWORK`, `CACHE_ELSE_NETWORK`, `NETWORK_ELSE_CACHE`), you must provide a persistence store via `cacheOptions.persistenceStore`. Install the optional persistence plugin and pass a `PersistenceStore` instance:

```bash
npm install @contentstack/persistence-plugin
```

```typescript
import contentstack, { Policy } from '@contentstack/delivery-sdk';
import { PersistenceStore } from '@contentstack/persistence-plugin';

const stack = contentstack.stack({
apiKey: 'your-api-key',
deliveryToken: 'your-delivery-token',
environment: 'your-environment',
cacheOptions: {
policy: Policy.CACHE_THEN_NETWORK,
persistenceStore: new PersistenceStore({ storeType: 'localStorage', maxAge: 86400000 }),
},
});
```

See [@contentstack/persistence-plugin](https://www.npmjs.com/package/@contentstack/persistence-plugin) for options (`storeType`, `maxAge`, custom storage).

### Development

When contributing or running tests from the repository, run `npm run build` before running tests. The published package includes a pre-built `dist/` directory.

### Helpful Links

- [Contentstack Website](https://www.contentstack.com)
Expand All @@ -197,7 +226,7 @@ const pagedResult = await query

### The MIT License (MIT)

Copyright © 2012-2025 [Contentstack](https://www.contentstack.com). All Rights Reserved
Copyright © 2012-2026 [Contentstack](https://www.contentstack.com). All Rights Reserved

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

Expand Down
11 changes: 0 additions & 11 deletions config/tsconfig.cjs.json

This file was deleted.

13 changes: 13 additions & 0 deletions config/tsconfig.decl-esm.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"extends": "../tsconfig.json",
"compilerOptions": {
"declaration": true,
"emitDeclarationOnly": true,
"module": "ESNext",
"moduleResolution": "Bundler",
"outDir": "../dist/modern",
"rootDir": "../src"
},
"include": ["../src/**/*.ts"],
"exclude": ["node_modules", "**/*.test.ts", "**/__test__"]
}
12 changes: 0 additions & 12 deletions config/tsconfig.esm.json

This file was deleted.

10 changes: 0 additions & 10 deletions config/tsconfig.types.json

This file was deleted.

9 changes: 0 additions & 9 deletions config/tsconfig.umd.json

This file was deleted.

42 changes: 0 additions & 42 deletions config/webpack.config.js

This file was deleted.

2 changes: 0 additions & 2 deletions jest.config.browser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@
*/
export default {
displayName: "browser-environment",
preset: "./jest.preset.js",

// ⚠️ CRITICAL: Use jsdom (browser) instead of node environment
testEnvironment: "jest-environment-jsdom",

Expand Down
3 changes: 2 additions & 1 deletion jest.config.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
/* eslint-disable */
export default {
displayName: "contentstack-delivery",
preset: "./jest.preset.js",
testEnvironment: "node",
testMatch: ["**/__tests__/**/*.ts", "**/?(*.)+(spec|test).ts"],
transform: {
"^.+\\.[tj]s$": [
"ts-jest",
Expand Down
15 changes: 0 additions & 15 deletions jest.preset.js

This file was deleted.

Loading