Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
5 changes: 5 additions & 0 deletions .cursor/rules/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Cursor (optional)

**Cursor** users: start at **[AGENTS.md](../../AGENTS.md)**. All conventions live in **`skills/*/SKILL.md`**.

This folder only points contributors to **`AGENTS.md`** so editor-specific config does not duplicate the canonical docs.
25 changes: 25 additions & 0 deletions .cursor/rules/code-review.mdc
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
---
description: "PR checklist for @contentstack/core — exports, semver, errors, tests, consumers"
alwaysApply: true
---

# Code review — `@contentstack/core`

## Public API

- **`src/index.ts`** exports match intended **npm `exports`**; new surface is documented and versioned.
- Changes that affect **`@contentstack/delivery-sdk`** require a coordinated plan (bump **core** + **SDK** as needed).

## Implementation

- Axios / retry / serializer changes remain **backward compatible** unless this is a **major** release.
- Errors use existing **classes** and **messages**; do not leak secrets in **logs** or **errors**.

## Tests & quality

- New logic includes **`test/*.spec.ts`** (or extends existing specs); **coverage thresholds** must still pass.
- **Lint** clean.

## Dependencies

- New dependencies need justification (bundle size, maintenance, license).
24 changes: 24 additions & 0 deletions .cursor/rules/contentstack-js-core.mdc
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
---
description: "@contentstack/core — Axios httpClient, errors, serialization, retry policies"
globs: ["src/**/*.ts"]
alwaysApply: false
---

# `@contentstack/core` implementation

## HTTP

- **`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.
- **`src/lib/request.ts`** and **`param-serializer.ts`** implement delivery-oriented query/body serialization — keep behavior aligned with CDA query expectations.

## Errors

- Use **`ContentstackError`** / **`ApiError`** and **`error-messages.ts`** for consistent messaging; preserve **status** / response metadata where applicable.

## Retries

- **`src/lib/retryPolicy/delivery-sdk-handlers.ts`** provides Axios interceptors (**retryRequestHandler**, **retryResponseHandler**, **retryResponseErrorHandler**) — changes here affect all consumers (including **@contentstack/delivery-sdk**).

## Testing

- Prefer **axios-mock-adapter** or mocks in **`test/utils`**; keep **`*.spec.ts`** focused and deterministic.
26 changes: 26 additions & 0 deletions .cursor/rules/dev-workflow.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
---
description: "Branches, build, lint, and PR expectations for contentstack-js-core"
globs: ["**/*.ts", "**/*.js", "**/*.json"]
alwaysApply: false
---

# Development workflow — `@contentstack/core`

## Before a PR

1. **`npm run lint`** — must pass.
2. **`npm test`** — Jest + coverage thresholds in `jest.config.ts` must be satisfied.
3. **`npm run build`** — CJS, ESM, UMD, and types must compile.

## API stability

- 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.
- Keep **`package.json` `exports`** in sync with `src/index.ts`.

## Versioning

- Bump **`package.json` `version`** for releases that change published behavior (patch/minor/major per semver).

## Links

- [`AGENTS.md`](../../AGENTS.md) · [`skills/contentstack-js-core/SKILL.md`](../../skills/contentstack-js-core/SKILL.md)
22 changes: 22 additions & 0 deletions .cursor/rules/testing.mdc
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
---
description: "Jest tests and coverage for @contentstack/core"
globs: ["test/**/*.ts"]
alwaysApply: false
---

# Testing — contentstack-js-core

## Runner

- **Jest** + **ts-jest** — see **`jest.config.ts`** / **`jest.preset.js`** / **`tsconfig.spec.json`**.
- **Coverage** is collected from **`src/**`** (with exclusions in config); **global thresholds** (branches/functions/lines/statements) apply — see `jest.config.ts`.

## Layout

- Specs: **`test/*.spec.ts`** (e.g. `request.spec.ts`, `contentstack-core.spec.ts`).
- Shared mocks: **`test/utils/mocks.ts`**.

## Hygiene

- No **committed** `it.only` / `describe.only` meant for CI.
- Avoid live network calls in unit tests unless explicitly an integration suite (this repo is primarily mocked unit tests).
28 changes: 28 additions & 0 deletions .cursor/rules/typescript.mdc
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
---
description: "TypeScript and repo conventions for @contentstack/core"
globs:
- "src/**/*.ts"
- "config/**/*.ts"
- "config/**/*.js"
- "tools/**/*.js"
- "jest.config.ts"
- "jest.preset.js"
alwaysApply: false
---

# TypeScript — contentstack-js-core

## Layout

- **`src/lib/*.ts`** — implementation modules; **`src/index.ts`** re-exports the public surface.
- **Configs** live under **`config/`** (multiple `tsconfig.*.json`, webpack).

## Style

- Follow **ESLint** (Airbnb TypeScript + Prettier) and existing patterns in `src/lib/`.
- Prefer **explicit types** on public exports and Axios-related options.
- Use **lodash** / **axios** patterns already present in `contentstack-core.ts` and `request.ts`.

## Security

- Do not log **api keys**, **access tokens**, or full auth headers in new code; align with existing **`logHandler`** usage.
2 changes: 1 addition & 1 deletion .talismanrc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
fileignoreconfig:
- filename: package-lock.json
checksum: 8b8088b2ef8210337d3a7f74d626b1ae4c2a4dcb0b5abab0c82e53e2d184eb04
checksum: c573bb4a5846055335df856bff87f28d9fccb90714ac4dbd699f5dcff2257615
version: ""
43 changes: 43 additions & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# @contentstack/core – Agent guide

**Universal entry point** for contributors and AI agents. Detailed conventions live in **`skills/*/SKILL.md`**.

## What this repo is

| Field | Detail |
|--------|--------|
| **Name:** | [contentstack-js-core](https://github.com/contentstack/contentstack-js-core) (`@contentstack/core`) |
| **Purpose:** | TypeScript core library: HTTP client wiring, errors, serialization, retries—shared by Contentstack TS SDKs. |
| **Out of scope:** | Not an end-user SDK; apps should use the Delivery SDK, which depends on this package. |

## Tech stack (at a glance)

| Area | Details |
|------|---------|
| Language | TypeScript (see `typescript` in `package.json`; `config/tsconfig.*.json`) |
| Build | `tsc` (CJS/ESM/types) + Webpack UMD (`config/webpack.config.js`, `tools/`) |
| Tests | Jest → `test/` (`npm test` → `jest ./test`) |
| Lint / coverage | ESLint `.eslintrc.js` (`npm run lint`) |
| CI | `.github/workflows/unit-test.yml`, `check-branch.yml`, `sca-scan.yml`, `policy-scan.yml`, `codeql-analysis.yml` |

## Commands (quick reference)

| Command type | Command |
|--------------|---------|
| Build | `npm run build` |
| Test | `npm test` |
| Lint | `npm run lint` |

## Where the documentation lives: skills

| Skill | Path | What it covers |
|-------|------|----------------|
| **Development workflow** | [`skills/dev-workflow/SKILL.md`](skills/dev-workflow/SKILL.md) | Branches, CI, npm scripts, Husky, release notes |
| **Contentstack core (package)** | [`skills/contentstack-core/SKILL.md`](skills/contentstack-core/SKILL.md) | `@contentstack/core` boundaries, public surface, dependency role |
| **TypeScript & layout** | [`skills/typescript/SKILL.md`](skills/typescript/SKILL.md) | `src/`, `config/` tsconfigs, ESM/CJS/UMD outputs |
| **Testing** | [`skills/testing/SKILL.md`](skills/testing/SKILL.md) | Jest layout, mocks, fixtures |
| **Code review** | [`skills/code-review/SKILL.md`](skills/code-review/SKILL.md) | PR expectations and checklist |

## Using Cursor (optional)

If you use **Cursor**, [`.cursor/rules/README.md`](.cursor/rules/README.md) only points to **`AGENTS.md`**—same docs as everyone else.
5 changes: 4 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
## Change log

### Version: 1.3.14
#### Date: May-04-2026
- Fix: Bump axios to ^1.15.2 (security patches for axios 1.15.0)

### Version: 1.3.13
#### Date: April-15-2026
- Fix: Axios version bump
Expand Down Expand Up @@ -88,7 +92,6 @@
#### Date: Oct-22-2024
- Fix: getData to receive params and headers both in data

## Change log
### Version: 1.1.2
#### Date: Oct-22-2024
- Node version bump
Expand Down
Loading
Loading