Skip to content

Commit 86e25b3

Browse files
authored
Merge pull request #222 from contentstack/development
DX | 04-05-2026 | Release
2 parents 6123bce + 8c89e18 commit 86e25b3

19 files changed

Lines changed: 474 additions & 87 deletions

File tree

.cursor/rules/README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Cursor (optional)
2+
3+
**Cursor** users: start at **[AGENTS.md](../../AGENTS.md)**. All conventions live in **`skills/*/SKILL.md`**.
4+
5+
This folder only points contributors to **`AGENTS.md`** so editor-specific config does not duplicate the canonical docs.

.cursor/rules/code-review.mdc

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
---
2+
description: "PR checklist for @contentstack/core — exports, semver, errors, tests, consumers"
3+
alwaysApply: true
4+
---
5+
6+
# Code review — `@contentstack/core`
7+
8+
## Public API
9+
10+
- **`src/index.ts`** exports match intended **npm `exports`**; new surface is documented and versioned.
11+
- Changes that affect **`@contentstack/delivery-sdk`** require a coordinated plan (bump **core** + **SDK** as needed).
12+
13+
## Implementation
14+
15+
- Axios / retry / serializer changes remain **backward compatible** unless this is a **major** release.
16+
- Errors use existing **classes** and **messages**; do not leak secrets in **logs** or **errors**.
17+
18+
## Tests & quality
19+
20+
- New logic includes **`test/*.spec.ts`** (or extends existing specs); **coverage thresholds** must still pass.
21+
- **Lint** clean.
22+
23+
## Dependencies
24+
25+
- New dependencies need justification (bundle size, maintenance, license).
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
---
2+
description: "@contentstack/core — Axios httpClient, errors, serialization, retry policies"
3+
globs: ["src/**/*.ts"]
4+
alwaysApply: false
5+
---
6+
7+
# `@contentstack/core` implementation
8+
9+
## HTTP
10+
11+
- **`httpClient(options)`** in **`src/lib/contentstack-core.ts`** builds the **Axios** instance: **baseURL**, headers (**api_key**, **access_token**), **timeout**, **retryCondition** (e.g. **429**), **logHandler**, **versioningStrategy**, etc.
12+
- **`src/lib/request.ts`** and **`param-serializer.ts`** implement delivery-oriented query/body serialization — keep behavior aligned with CDA query expectations.
13+
14+
## Errors
15+
16+
- Use **`ContentstackError`** / **`ApiError`** and **`error-messages.ts`** for consistent messaging; preserve **status** / response metadata where applicable.
17+
18+
## Retries
19+
20+
- **`src/lib/retryPolicy/delivery-sdk-handlers.ts`** provides Axios interceptors (**retryRequestHandler**, **retryResponseHandler**, **retryResponseErrorHandler**) — changes here affect all consumers (including **@contentstack/delivery-sdk**).
21+
22+
## Testing
23+
24+
- Prefer **axios-mock-adapter** or mocks in **`test/utils`**; keep **`*.spec.ts`** focused and deterministic.

.cursor/rules/dev-workflow.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
---
2+
description: "Branches, build, lint, and PR expectations for contentstack-js-core"
3+
globs: ["**/*.ts", "**/*.js", "**/*.json"]
4+
alwaysApply: false
5+
---
6+
7+
# Development workflow — `@contentstack/core`
8+
9+
## Before a PR
10+
11+
1. **`npm run lint`** — must pass.
12+
2. **`npm test`** — Jest + coverage thresholds in `jest.config.ts` must be satisfied.
13+
3. **`npm run build`** — CJS, ESM, UMD, and types must compile.
14+
15+
## API stability
16+
17+
- This package is a **dependency of `@contentstack/delivery-sdk`**. Avoid breaking changes to exported functions, option shapes, or error types without a **semver-major** bump and coordinated **delivery-sdk** upgrade.
18+
- Keep **`package.json` `exports`** in sync with `src/index.ts`.
19+
20+
## Versioning
21+
22+
- Bump **`package.json` `version`** for releases that change published behavior (patch/minor/major per semver).
23+
24+
## Links
25+
26+
- [`AGENTS.md`](../../AGENTS.md) · [`skills/contentstack-js-core/SKILL.md`](../../skills/contentstack-js-core/SKILL.md)

.cursor/rules/testing.mdc

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
---
2+
description: "Jest tests and coverage for @contentstack/core"
3+
globs: ["test/**/*.ts"]
4+
alwaysApply: false
5+
---
6+
7+
# Testing — contentstack-js-core
8+
9+
## Runner
10+
11+
- **Jest** + **ts-jest** — see **`jest.config.ts`** / **`jest.preset.js`** / **`tsconfig.spec.json`**.
12+
- **Coverage** is collected from **`src/**`** (with exclusions in config); **global thresholds** (branches/functions/lines/statements) apply — see `jest.config.ts`.
13+
14+
## Layout
15+
16+
- Specs: **`test/*.spec.ts`** (e.g. `request.spec.ts`, `contentstack-core.spec.ts`).
17+
- Shared mocks: **`test/utils/mocks.ts`**.
18+
19+
## Hygiene
20+
21+
- No **committed** `it.only` / `describe.only` meant for CI.
22+
- Avoid live network calls in unit tests unless explicitly an integration suite (this repo is primarily mocked unit tests).

.cursor/rules/typescript.mdc

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
---
2+
description: "TypeScript and repo conventions for @contentstack/core"
3+
globs:
4+
- "src/**/*.ts"
5+
- "config/**/*.ts"
6+
- "config/**/*.js"
7+
- "tools/**/*.js"
8+
- "jest.config.ts"
9+
- "jest.preset.js"
10+
alwaysApply: false
11+
---
12+
13+
# TypeScript — contentstack-js-core
14+
15+
## Layout
16+
17+
- **`src/lib/*.ts`** — implementation modules; **`src/index.ts`** re-exports the public surface.
18+
- **Configs** live under **`config/`** (multiple `tsconfig.*.json`, webpack).
19+
20+
## Style
21+
22+
- Follow **ESLint** (Airbnb TypeScript + Prettier) and existing patterns in `src/lib/`.
23+
- Prefer **explicit types** on public exports and Axios-related options.
24+
- Use **lodash** / **axios** patterns already present in `contentstack-core.ts` and `request.ts`.
25+
26+
## Security
27+
28+
- Do not log **api keys**, **access tokens**, or full auth headers in new code; align with existing **`logHandler`** usage.

.talismanrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
fileignoreconfig:
22
- filename: package-lock.json
3-
checksum: 8b8088b2ef8210337d3a7f74d626b1ae4c2a4dcb0b5abab0c82e53e2d184eb04
3+
checksum: c573bb4a5846055335df856bff87f28d9fccb90714ac4dbd699f5dcff2257615
44
version: ""

AGENTS.md

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
# @contentstack/core – Agent guide
2+
3+
**Universal entry point** for contributors and AI agents. Detailed conventions live in **`skills/*/SKILL.md`**.
4+
5+
## What this repo is
6+
7+
| Field | Detail |
8+
|--------|--------|
9+
| **Name:** | [contentstack-js-core](https://github.com/contentstack/contentstack-js-core) (`@contentstack/core`) |
10+
| **Purpose:** | TypeScript core library: HTTP client wiring, errors, serialization, retries—shared by Contentstack TS SDKs. |
11+
| **Out of scope:** | Not an end-user SDK; apps should use the Delivery SDK, which depends on this package. |
12+
13+
## Tech stack (at a glance)
14+
15+
| Area | Details |
16+
|------|---------|
17+
| Language | TypeScript (see `typescript` in `package.json`; `config/tsconfig.*.json`) |
18+
| Build | `tsc` (CJS/ESM/types) + Webpack UMD (`config/webpack.config.js`, `tools/`) |
19+
| Tests | Jest → `test/` (`npm test``jest ./test`) |
20+
| Lint / coverage | ESLint `.eslintrc.js` (`npm run lint`) |
21+
| CI | `.github/workflows/unit-test.yml`, `check-branch.yml`, `sca-scan.yml`, `policy-scan.yml`, `codeql-analysis.yml` |
22+
23+
## Commands (quick reference)
24+
25+
| Command type | Command |
26+
|--------------|---------|
27+
| Build | `npm run build` |
28+
| Test | `npm test` |
29+
| Lint | `npm run lint` |
30+
31+
## Where the documentation lives: skills
32+
33+
| Skill | Path | What it covers |
34+
|-------|------|----------------|
35+
| **Development workflow** | [`skills/dev-workflow/SKILL.md`](skills/dev-workflow/SKILL.md) | Branches, CI, npm scripts, Husky, release notes |
36+
| **Contentstack core (package)** | [`skills/contentstack-core/SKILL.md`](skills/contentstack-core/SKILL.md) | `@contentstack/core` boundaries, public surface, dependency role |
37+
| **TypeScript & layout** | [`skills/typescript/SKILL.md`](skills/typescript/SKILL.md) | `src/`, `config/` tsconfigs, ESM/CJS/UMD outputs |
38+
| **Testing** | [`skills/testing/SKILL.md`](skills/testing/SKILL.md) | Jest layout, mocks, fixtures |
39+
| **Code review** | [`skills/code-review/SKILL.md`](skills/code-review/SKILL.md) | PR expectations and checklist |
40+
41+
## Using Cursor (optional)
42+
43+
If you use **Cursor**, [`.cursor/rules/README.md`](.cursor/rules/README.md) only points to **`AGENTS.md`**—same docs as everyone else.

CHANGELOG.md

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

3+
### Version: 1.3.14
4+
#### Date: May-04-2026
5+
- Fix: Bump axios to ^1.15.2 (security patches for axios 1.15.0)
6+
37
### Version: 1.3.13
48
#### Date: April-15-2026
59
- Fix: Axios version bump
@@ -88,7 +92,6 @@
8892
#### Date: Oct-22-2024
8993
- Fix: getData to receive params and headers both in data
9094

91-
## Change log
9295
### Version: 1.1.2
9396
#### Date: Oct-22-2024
9497
- Node version bump

0 commit comments

Comments
 (0)