Skip to content

Commit 071aef5

Browse files
Merge branch 'development' into feat/taxonomy-publishing
2 parents 43bc2aa + f791af6 commit 071aef5

175 files changed

Lines changed: 23059 additions & 8273 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.gitignore

Lines changed: 35 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,39 @@ tap-html.html
1212
coverage
1313
.env
1414
.dccache
15-
dist/*
15+
dist/
16+
.idea/
17+
.vscode/
18+
*.swp
19+
*.swo
20+
*~
21+
.cache
22+
test-results/
23+
24+
# Build artifacts (should only be in dist/)
25+
src/**/*.js
26+
src/**/*.js.map
27+
28+
# Compiled test artifacts (use .ts source only)
29+
test/api/**/*.js
30+
test/api/**/*.js.map
31+
32+
# Browser test bundle (generated)
33+
test/e2e/sdk-browser-bundle.js
34+
test/e2e/sdk-browser-bundle.js.map
35+
docs
36+
reports
37+
38+
# Bundler test artifacts (regenerated on test run)
39+
test/bundlers/**/.next/
40+
test/bundlers/**/dist/
41+
test/bundlers/**/node_modules/
42+
test/bundlers/**/package-lock.json
43+
44+
# Temporary internal scripts
45+
test/docs/*.js
46+
test/docs/*.mjs
47+
test/docs/sanity-report*
1648
*.log
17-
.nx/
49+
.nx/
50+
delivery-sdk-persistence/

.talismanrc

Lines changed: 55 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,67 @@
11
fileignoreconfig:
2-
- filename: package-lock.json
3-
checksum: cb21e1b4fc8240b8ee33c6f974a9d1cf25d96afb9161c85633cbb061f069bbc4
2+
- filename: README.md
3+
checksum: b40240271f930e1c0db9bbcf78a55bf0d52d6caf0eb265eae94d1a2aecf442c5
4+
- filename: test/unit/error-messages.spec.ts
5+
checksum: 186390727b2488317c49f22955ade58b454d4c00c6b850bbb0617c30c59f8255
6+
- filename: src/common/types.ts
7+
checksum: 0466775043773ec966f10bac2eeed812274748fc275a1017ad51295dff5c58ca
48
- filename: test/unit/contentstack.spec.ts
5-
checksum: d5b99c01459ab8bc597baaa9e6cc4aa91ac6d9bf78af08e1d0220d0c5db3d0b3
9+
checksum: 8f560efd9fba6e04682899eff3cc448d22c38019eac0a5ffcab35ba59f81da2c
10+
- filename: test/unit/cache.spec.ts
11+
checksum: a9bf179485c09e3821d78588a6bd2a57a70b68dd05948f7187c73d05b846b651
12+
- filename: test/browser/import.spec.ts
13+
checksum: 2e9a157e28b0ce71c4b6422c6b457996a2e6785a1ef591c8bb35276b3471a5d0
14+
- filename: scripts/test-bundlers.js
15+
checksum: 4a85cdc2f456d2f9d64d96eedaeddd34f192f243f352132957b1a9c0e979d635
16+
- filename: test/browser/helpers/browser-stack-instance.ts
17+
checksum: 333fdbd1229022736e6e3262c7f275cb22534ec149d4e9a8270f0745b60d8661
18+
- filename: scripts/validate-browser-safe.js
19+
checksum: 769b95cf55a6cf8455d057a662a8071286faf62a75862e3317d79367fe1ed5b4
20+
- filename: test/browser/initialization.spec.ts
21+
checksum: 4054847ebfcc980299240a27d0aa30c1f43a9482e6ba39ac0af6126e7db9e04a
22+
- filename: test/e2e/browser-integration.spec.ts
23+
checksum: 6646595d48bfaec3d9de111b22b36cf0925b33e18df55b068181c0bb81c1862b
24+
- filename: test/browser/real-api-calls.spec.ts
25+
checksum: 514930cdde28cdc8b37ab054031260d5703dc8bdf777906dd5f9baa270ab7c3a
626
- filename: test/unit/utils.spec.ts
7-
checksum: 79ce5bd78376db37a34df82c0fea19031e995b66a5a246e73f8262fa05d65a9c
27+
checksum: a491df0a19c336ff5b18450fb23e26676a1798222100c946150e7a1b6504d953
828
- filename: test/unit/query-optimization-comprehensive.spec.ts
929
checksum: f5aaf6c784d7c101a05ca513c584bbd6e95f963d1e42779f2596050d9bcbac96
10-
- filename: src/lib/entries.ts
30+
- filename: src/entries/entries.ts
1131
checksum: f6a19da15baed75062ad0cc599573ed08926e28fffe3f6e4890a0efb4d58c910
12-
- filename: src/lib/cache.ts
32+
- filename: src/cache/cache.ts
1333
checksum: d8d32089b8a4b247e4ba71c22b56cbb0a54440ebf35b102af222eb8032919f02
14-
- filename: test/unit/cache.spec.ts
15-
checksum: e96f913a466a1f4d55a422e7032fc2c06eeed5fea86cdcc86a05fbe3eba29b7a
16-
- filename: src/lib/query.ts
34+
- filename: src/query/query.ts
1735
checksum: 073c47e46755eb79d1d7e9fcaf2864296a218bf650888dd37c42480cce7df379
1836
- filename: test/api/retry-integration.spec.ts
1937
checksum: dc07b0a8111fd8e155b99f56c31ccdddd4f46c86f1b162b17d73e15dfed8e3c8
2038
- filename: test/unit/retry-configuration.spec.ts
2139
checksum: 359c8601c6205a65f3395cc209a93b278dfe7f5bb547c91b2eeab250b2c85aa3
22-
version: ""
40+
- filename: package-lock.json
41+
checksum: 993afd503e9f5d399fac30ae230cb47538cec2c61c5364e88be72726fb723dda
42+
ignore_detectors: [ base64, filecontent ]
43+
- filename: src/global-field/global-field.ts
44+
checksum: 70b9652bcba16ddc4d853ac212ad909a8ecfc76f491c55a05e4e3cdf9ce476b5
45+
- filename: src/content-type/content-type.ts
46+
checksum: 1dc0fa53ae209efb67d68a01493822e9dec560799f8309329213dae69459655f
47+
- filename: src/stack/stack.ts
48+
checksum: 145dd6add876a771a9a6ba024f57ef2c4b46a911fe1bf3885a69cf1f6c9dd72d
49+
- filename: src/entries/entry.ts
50+
checksum: 1c64ccf19226873d068d6896028bfb74546c1cfd993779515bccfcc747180ca0
51+
- filename: src/common/error-messages.ts
52+
checksum: 3b960af19f3ba302522e912616b147b11d63dfe3f7ad2e0cf2de807815ee236a
53+
- filename: src/query/global-field-query.ts
54+
checksum: 824c54061b80236380e776640e7f52f45164230bcc0ee88de302b30e9f83297f
55+
- filename: src/query/base-query.ts
56+
checksum: 8d67435121581d43ba9c5f544daf30a0579b7faa7c8661000d8d37ddfc172112
57+
- filename: test/unit/base-query.spec.ts
58+
checksum: ceaceb1d65965b151edc9fc11d5a226460328b1913319994df51ca1b453cd6af
59+
- filename: test/api/modular-blocks.spec.ts
60+
checksum: 1e536b0409f05f2d5c1d6e87b0ec4bda2c3fde9bc4ff331406f33464a26cff55
61+
- filename: test/unit/centralized-error-handling.spec.ts
62+
checksum: 66a5eb520414bd71da331338bfb4faa2fc9f233eadf0eb18ddd7915db6849238
63+
- filename: test/api/base-query-casting.specs.ts
64+
checksum: 9185df498914e2966d78d9d216acaaa910d43cd7ac9a5e9a26e7241ac9edc9b5
65+
- filename: test/reporting/generate-unified-report.js
66+
checksum: 9e7a4696561b790cb93f3be8406a70ec6fdc90a3f8bbb9739504495690158fe3
67+
version: "1.0"

CHANGELOG.md

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,38 @@
1+
### Version: 5.1.1
2+
#### Date: Mar-09-2026
3+
Fix: Added support of special symbols in regex method with safe pattern.
4+
5+
### Version: 5.1.0
6+
#### Date: Mar-02-2026
7+
Fix: Added support of asset fields in assets & entries class.
8+
9+
### Version: 5.0.1
10+
#### Date: feb-23-2026
11+
Fix: Added support of special symbols in regex method with safe pattern.
12+
13+
### Version: 5.0.0
14+
#### Date: Feb-16-2026
15+
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`.
16+
Enhancement: SDK defines only the `PersistenceStore` interface (getItem/setItem); full implementation lives in the plugin for a lighter core package.
17+
Fix: Sync API returns non-Axios response causing undefined data and recursive sync failure
18+
19+
### Version: 4.11.2
20+
#### Date: feb-11-2026
21+
Fix: JS core & axios version bump
22+
23+
24+
### Version: 4.11.2
25+
#### Date: feb-11-2026
26+
Fix: JS core & axios version bump
27+
28+
### Version: 4.11.1
29+
#### Date: Feb-09-2026
30+
Fix: Fix security issues
31+
32+
### Version: 4.11.0
33+
#### Date: Jan-19-2026
34+
Enhancement: Integrated getContentstackEndpoint method of Utils SDK for endpoint selection
35+
136
### Version: 4.10.5
237
#### Date: Jan-05-2026
338
Fix: update esm export path to include .js extension (upgrade contentstack-js-core dependency)

README.md

Lines changed: 88 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ The Typescript SDK can also be used to create Node.js and React native applicati
99

1010
### Prerequisite
1111

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

1414
### Setup and Installation
1515

@@ -66,6 +66,63 @@ You will need to specify the API key, Delivery Token, and Environment Name of yo
6666

6767
Once you have initialized the SDK, you can start getting content in your app.
6868

69+
#### Region and Host Configuration
70+
71+
The SDK supports region and custom host configuration to connect to different Contentstack data centers or custom endpoints.
72+
73+
**Region Support**
74+
75+
You can specify a region to connect to the appropriate Contentstack data center. Available regions are:
76+
- `US` (default) - Uses `cdn.contentstack.io`
77+
- `EU` - Uses `eu-cdn.contentstack.com`
78+
- `AU` - Uses `au-cdn.contentstack.com`
79+
- `AZURE_NA` - Uses `azure-na-cdn.contentstack.com`
80+
- `AZURE_EU` - Uses `azure-eu-cdn.contentstack.com`
81+
- `GCP_NA` - Uses `gcp-na-cdn.contentstack.com`
82+
- `GCP_EU` - Uses `gcp-eu-cdn.contentstack.com`
83+
84+
```typescript
85+
import contentstack, { Region } from '@contentstack/delivery-sdk'
86+
87+
// Using region enum
88+
const stack = contentstack.stack({
89+
apiKey: "apiKey",
90+
deliveryToken: "deliveryToken",
91+
environment: "environment",
92+
region: Region.EU
93+
});
94+
95+
// Using region string
96+
const stack = contentstack.stack({
97+
apiKey: "apiKey",
98+
deliveryToken: "deliveryToken",
99+
environment: "environment",
100+
region: "eu"
101+
});
102+
```
103+
104+
**Custom Host Support**
105+
106+
You can specify a custom host to connect to a custom endpoint. If a custom host is provided, it takes priority over the region-based host.
107+
108+
```typescript
109+
const stack = contentstack.stack({
110+
apiKey: "apiKey",
111+
deliveryToken: "deliveryToken",
112+
environment: "environment",
113+
host: "custom-cdn.example.com"
114+
});
115+
116+
// Custom host with region (host takes priority)
117+
const stack = contentstack.stack({
118+
apiKey: "apiKey",
119+
deliveryToken: "deliveryToken",
120+
environment: "environment",
121+
region: Region.EU,
122+
host: "custom-cdn.example.com"
123+
});
124+
```
125+
69126
#### Querying content from your stack
70127

71128
To get a single entry, you need to specify the content type as well as the ID of the entry.
@@ -132,6 +189,35 @@ const pagedResult = await query
132189

133190
```
134191

192+
### Caching
193+
194+
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:
195+
196+
```bash
197+
npm install @contentstack/persistence-plugin
198+
```
199+
200+
```typescript
201+
import contentstack, { Policy } from '@contentstack/delivery-sdk';
202+
import { PersistenceStore } from '@contentstack/persistence-plugin';
203+
204+
const stack = contentstack.stack({
205+
apiKey: 'your-api-key',
206+
deliveryToken: 'your-delivery-token',
207+
environment: 'your-environment',
208+
cacheOptions: {
209+
policy: Policy.CACHE_THEN_NETWORK,
210+
persistenceStore: new PersistenceStore({ storeType: 'localStorage', maxAge: 86400000 }),
211+
},
212+
});
213+
```
214+
215+
See [@contentstack/persistence-plugin](https://www.npmjs.com/package/@contentstack/persistence-plugin) for options (`storeType`, `maxAge`, custom storage).
216+
217+
### Development
218+
219+
When contributing or running tests from the repository, run `npm run build` before running tests. The published package includes a pre-built `dist/` directory.
220+
135221
### Helpful Links
136222

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

141227
### The MIT License (MIT)
142228

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

145231
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:
146232

config/tsconfig.cjs.json

Lines changed: 0 additions & 11 deletions
This file was deleted.

config/tsconfig.decl-esm.json

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"extends": "../tsconfig.json",
3+
"compilerOptions": {
4+
"declaration": true,
5+
"emitDeclarationOnly": true,
6+
"module": "ESNext",
7+
"moduleResolution": "Bundler",
8+
"outDir": "../dist/modern",
9+
"rootDir": "../src"
10+
},
11+
"include": ["../src/**/*.ts"],
12+
"exclude": ["node_modules", "**/*.test.ts", "**/__test__"]
13+
}

config/tsconfig.esm.json

Lines changed: 0 additions & 12 deletions
This file was deleted.

config/tsconfig.types.json

Lines changed: 0 additions & 10 deletions
This file was deleted.

config/tsconfig.umd.json

Lines changed: 0 additions & 9 deletions
This file was deleted.

config/webpack.config.js

Lines changed: 0 additions & 42 deletions
This file was deleted.

0 commit comments

Comments
 (0)