Skip to content

Commit 8029b41

Browse files
committed
fix: ESM compatibility fixes and improved error handling
1 parent 2b7d73e commit 8029b41

8 files changed

Lines changed: 339 additions & 106 deletions

File tree

.talismanrc

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ fileignoreconfig:
33
ignore_detectors:
44
- filecontent
55
- filename: package-lock.json
6-
checksum: af3bffd9f46b71daf5b8dd0b3eace75dfd367e359b11503259dc00a8c7105bf0
6+
checksum: 59653dc17458f6bddffb6178bfb8f8191ad4715f41a788082a11d3b08e966b4c
77
- filename: .husky/pre-commit
88
checksum: 5baabd7d2c391648163f9371f0e5e9484f8fb90fa2284cfc378732ec3192c193
99
- filename: test/request.spec.ts
@@ -14,4 +14,6 @@ fileignoreconfig:
1414
checksum: 08ccd6342b3adbeb7b85309a034b4df4b2ad905a0cc2a3778ab483b61ba41b9e
1515
- filename: test/retryPolicy/delivery-sdk-handlers.spec.ts
1616
checksum: 6d22d7482aa6dccba5554ae497e5b0c3572357a5cead6f4822ee4428edc12207
17+
- filename: test/contentstack-core.spec.ts
18+
checksum: 2d1e0f63ad8ea37890de2aa6c7e394c83488888f4a40ad7a71eeba2290b95924
1719
version: ""

CHANGELOG.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
11
## Change log
22

3+
### Version: 1.3.8
4+
#### Date: Jan-15-2026
5+
- Fix: Add .js extensions to relative imports in ESM build for proper module resolution
6+
- Fix: Change lodash import from named import to default import for ESM compatibility with CommonJS modules
7+
8+
### Version: 1.3.7
9+
#### Date: Jan-12-2026
10+
- Fix: Improve error messages
11+
312
### Version: 1.3.6
413
#### Date: Jan-05-2026
514
- Fix: Resolve qa dependency snyk issue

README.md

Lines changed: 99 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,46 +1,129 @@
1+
# @contentstack/core
2+
13
[![Contentstack](https://www.contentstack.com/docs/static/images/contentstack.png)](https://www.contentstack.com/)
2-
## TypeScript Core SDK for Contentstack
4+
5+
TypeScript Core SDK for Contentstack - A foundational library providing core modules and utilities for Contentstack TypeScript SDKs.
6+
7+
## About Contentstack
38

49
Contentstack is a headless CMS with an API-first approach. It is a CMS that developers can use to build powerful cross-platform applications in their favorite languages. Build your application frontend, and Contentstack will take care of the rest. [Read More](https://www.contentstack.com/).
510

6-
### Prerequisite
11+
## Description
712

8-
You need Node.js version 4.4.7 or later installed to use the Contentstack TS Core SDK.
13+
This package contains core modules and utilities used by the [Contentstack TypeScript Delivery SDK](https://github.com/contentstack/contentstack-javascript/). It provides essential functionality including HTTP client configuration, error handling, request management, parameter serialization, and retry policies.
914

10-
## Installation
15+
## Features
1116

12-
```
17+
- **HTTP Client**: Configurable Axios-based HTTP client with support for custom adapters
18+
- **Error Handling**: Comprehensive error classes for API and Contentstack-specific errors
19+
- **Request Management**: Request handling with interceptors and custom error callbacks
20+
- **Parameter Serialization**: Custom parameter serialization for API requests
21+
- **Retry Policies**: Built-in retry logic for handling rate limits and transient errors
22+
- **TypeScript Support**: Full TypeScript definitions included
23+
- **Multiple Build Formats**: Supports CommonJS, ESM, UMD, and TypeScript declarations
24+
25+
## Important Note
26+
27+
**This package is an internal dependency** used by Contentstack TypeScript SDKs. End users should **not** install this package directly. Instead, install the appropriate Contentstack SDK (e.g., [Contentstack TypeScript Delivery SDK](https://github.com/contentstack/contentstack-typescript/)), which will automatically include this package as a dependency.
28+
29+
## For SDK Developers
30+
31+
If you are developing or maintaining a Contentstack SDK and need to use this core package directly, you can install it as a dependency:
32+
33+
```bash
1334
npm install @contentstack/core
1435
```
1536

16-
## Use case
37+
Then import the modules:
1738

18-
This package contains some core modules and utilities used by the [Contentstack Typescript Delivery SDK](https://github.com/contentstack/contentstack-javascript/) SDK.
39+
```typescript
40+
import {
41+
httpClient,
42+
ContentstackError,
43+
ApiError,
44+
// ... other exports
45+
} from '@contentstack/core';
46+
```
1947

2048
## Development
2149

22-
### Create the build:
50+
### Prerequisites
2351

52+
- Node.js version 4.4.7 or later
53+
54+
### Setup
55+
56+
Clone the repository and install dependencies:
57+
58+
```bash
59+
git clone https://github.com/contentstack/contentstack-js-core.git
60+
cd contentstack-js-core
61+
npm install
2462
```
63+
64+
### Build
65+
66+
Build all output formats (CommonJS, ESM, UMD, and TypeScript declarations):
67+
68+
```bash
2569
npm run build
2670
```
2771

28-
### Run Scripts:
29-
30-
Run the unit tests:
72+
Build specific formats:
3173

74+
```bash
75+
npm run build:cjs # CommonJS
76+
npm run build:esm # ES Modules
77+
npm run build:umd # UMD
78+
npm run build:types # TypeScript declarations
3279
```
80+
81+
### Testing
82+
83+
Run unit tests:
84+
85+
```bash
3386
npm run test
3487
```
3588

36-
Run the lint tests:
89+
Run linting:
3790

38-
```
91+
```bash
3992
npm run lint
4093
```
4194

42-
Pack the SDK:
95+
### Packaging
4396

44-
```
97+
Create a package tarball:
98+
99+
```bash
45100
npm run package
46-
```
101+
```
102+
103+
### Clean
104+
105+
Clean build artifacts:
106+
107+
```bash
108+
npm run clean
109+
```
110+
111+
## License
112+
113+
This project is licensed under the MIT License. See the [LICENSE.txt](LICENSE.txt) file for details.
114+
115+
## Repository
116+
117+
- **GitHub**: [contentstack/contentstack-js-core](https://github.com/contentstack/contentstack-js-core)
118+
119+
## Related Projects
120+
121+
- [Contentstack TypeScript Delivery SDK](https://github.com/contentstack/contentstack-javascript/)
122+
123+
## Support
124+
125+
For issues and feature requests, please visit the [GitHub Issues](https://github.com/contentstack/contentstack-js-core/issues) page.
126+
127+
---
128+
129+
Copyright (c) 2016-2025 Contentstack. All rights reserved.

0 commit comments

Comments
 (0)