Skip to content
Open
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
30 changes: 21 additions & 9 deletions .circleci/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ CircleCI validates **arangojs** using one parameterized job, `**node-test`**, wi

| Pipeline parameter `docker-img` | Workflows | DB / coverage |
| ------------------------------- | ------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------- |
| **Empty** (default) | `**integration-single-topology`**, `**integration-cluster-topology**`, `**integration-http-proto-smoke**`, `**browser-smoke**` | **36** jobs total. |
| **Empty** (default) | `**integration-single-topology`**, `**integration-cluster-topology**`, `**integration-http-proto-smoke**`, `**browser-smoke**`, `**compat-typescript**` | **40** jobs total (36 DB/browser + 4 TypeScript consumer compat). |
| **Non-empty** | **`integration-tests-given-db-image`**, **`integration-http-proto-smoke-given-db-image`**, **`browser-smoke-given-db-image`** | **19** jobs total (16 + 2 + 1); same split as the default pipeline |

### Secrets and context
Expand All @@ -25,7 +25,8 @@ All integration and browser jobs attach **`context: docker-hub`**.

| Job | Executor | Resource class |
| --- | -------- | -------------- |
| **`node-test`** | `n22` / `n24` | `arangodb/medium-arm64-privileged` |
| **`node-test`** (single / HTTP smoke) | `n22` / `n24` | `arangodb/small-arm64-privileged` |
| **`node-test`** (cluster) | `n22` / `n24` | `arangodb/medium-arm64-privileged` |
| **`browser-smoke`** | `n24-browser` (`cimg/node:24.4`) | `arangodb/medium-amd64-privileged` |

- **`setup-docker`** — install Docker CLI, start in-container `dockerd` (DinD).
Expand All @@ -44,9 +45,9 @@ All integration and browser jobs attach **`context: docker-hub`**.

---

## 2) Default pipeline (`docker-img` empty) — **36 jobs**
## 2) Default pipeline (`docker-img` empty) — **40 jobs**

Four workflows run in parallel (`when: not <<pipeline.parameters.docker-img>>`).
Five workflows run in parallel (`when: not <<pipeline.parameters.docker-img>>`).

### A) `integration-single-topology` (**16** jobs)

Expand Down Expand Up @@ -96,7 +97,18 @@ Puppeteer + `smoke-test.mjs` (esbuild browser bundle, `db.version()` in headless

**Naming:** `browser-smoke-312`, `browser-smoke-4.0-nightly`

**Grand total (empty `docker-img`):** 16 + 16 + 2 + 2 = **36** jobs.
### E) `compat-typescript` — **4 jobs** (no ArangoDB / Docker)

Builds and packs the publishable driver tarball once, then typechecks it as a consumer on TypeScript **5.4**, **6.0**, and **7.0** (see `compat-test/`).

| Job | Role |
| --- | ---- |
| **`compat-pack`** | `npm install --ignore-scripts`, `npm run build`, `npm pack` → workspace `arangojs-pack.tgz` |
| **`compat-consumer-ts5`** | Install pack + `typescript@5.4.5`, `npx tsc --noEmit` |
| **`compat-consumer-ts6`** | Install pack + `typescript@6.0.3`, `npx tsc --noEmit` |
| **`compat-consumer-ts7`** | Install pack + `typescript@7.0.2`, `npx tsc --noEmit` |

**Grand total (empty `docker-img`):** 16 + 16 + 2 + 2 + 4 = **40** jobs.

---

Expand All @@ -111,15 +123,15 @@ All run when **`docker-img`** is set (Trigger Pipeline). They use the same **`<<
| ------------------- | ----------------------------------------------- |
| **Docker DB image** | `<<pipeline.parameters.docker-img>>` |
| **Node** | `n22`, `n24` |
| **Topology** | `single`, `cluster` |
| **Topology** | `single` (small runners), `cluster` (medium) |
| **SSL** | `true`, `false` |
| **Module system** | `cjs`, `esm` |
| **HTTP** | Default `**h1`** only (no `http_proto` matrix). |


**Job count:** 2 × 2 × 2 × 2 = **16**.
**Job count:** 2 × 2 × 2 × 2 = **16** (8 single + 8 cluster).

**Naming:** `<node>-<topology>-ssl<true|false>-<cjs|esm>`
**Naming:** `<node>-single-ssl<true|false>-<cjs|esm>` | `<node>-cluster-ssl<true|false>-<cjs|esm>`

### B) `integration-http-proto-smoke-given-db-image` (**2** jobs)

Expand Down Expand Up @@ -182,7 +194,7 @@ Same Docker setup and **`login-docker-hub`** → **`start-db`** (single, HTTP) a
### Default (PR / push)

- Do **not** set `docker-img`.
- Runs **36** jobs across the four workflows above (single matrix + cluster matrix + HTTP proto smoke + browser smoke).
- Runs **40** jobs across the five workflows above (single matrix + cluster matrix + HTTP proto smoke + browser smoke + TypeScript consumer compat).

### Custom DB image

Expand Down
110 changes: 103 additions & 7 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -96,11 +96,9 @@ executors:
n22:
docker:
- image: cimg/node:22.22.3
resource_class: arangodb/medium-arm64-privileged
n24:
docker:
- image: cimg/node:24.16.0
resource_class: arangodb/medium-arm64-privileged
n24-browser:
docker:
- image: cimg/node:24.16.0
Expand Down Expand Up @@ -128,7 +126,12 @@ jobs:
module-system:
type: enum
enum: ['cjs', 'esm']
# Single-server DinD fits small; cluster stays on medium.
resource_class:
type: string
default: 'arangodb/medium-arm64-privileged'
executor: <<parameters.node>>
resource_class: <<parameters.resource_class>>
steps:
- timeout
- checkout
Expand Down Expand Up @@ -216,6 +219,51 @@ jobs:
PUPPETEER_EXECUTABLE_PATH: /usr/bin/google-chrome-stable
ARANGO_PROXY_TARGET: 172.28.0.1:8529

# Build the driver with the repo toolchain (TypeScript 7) and pack the publishable
# tarball. No ArangoDB / Docker needed.
compat-pack:
executor: n22
steps:
- checkout
- run:
name: Install jq
command: sudo apt-get update && sudo apt-get install -y --no-install-recommends jq
- run:
name: Install dependencies
command: npm install --ignore-scripts
- run:
name: Build and pack publishable tarball
command: |
set -euo pipefail
npm run build
cd build
npm pack
mv arangojs-*.tgz ../arangojs-pack.tgz
- persist_to_workspace:
root: .
paths:
- arangojs-pack.tgz

# Install the packed tarball in a sample consumer project and typecheck it with a
# specific TypeScript version, simulating a customer on that version.
compat-consumer:
parameters:
ts:
type: string
executor: n22
steps:
- checkout
- attach_workspace:
at: /tmp/workspace
- run:
name: Typecheck as TypeScript << parameters.ts >> consumer
working_directory: compat-test
command: |
set -euo pipefail
npm install --save-dev typescript@<< parameters.ts >> @types/node@20
npm install --save arangojs@file:/tmp/workspace/arangojs-pack.tgz
npx tsc --noEmit

workflows:
# 16 jobs: single-server only. HTTP/1.1 (default http_proto). 2 DB × 2 Node × 2 SSL × 2 module systems.
integration-single-topology:
Expand All @@ -226,6 +274,7 @@ workflows:
name: single-<<matrix.node>>-ssl<<matrix.ssl>>-<<matrix.module-system>>-312
context: docker-hub
topology: single
resource_class: arangodb/small-arm64-privileged
filters:
branches:
ignore: stable
Expand All @@ -246,6 +295,7 @@ workflows:
name: single-<<matrix.node>>-ssl<<matrix.ssl>>-<<matrix.module-system>>-4.0-nightly
context: docker-hub
topology: single
resource_class: arangodb/small-arm64-privileged
filters:
branches:
ignore: stable
Expand Down Expand Up @@ -322,6 +372,7 @@ workflows:
ignore: stable
docker-img: 'gcr.io/gcr-for-testing/arangodb/enterprise:3.12'
topology: single
resource_class: arangodb/small-arm64-privileged
ssl: 'true'
http_proto: h1
node: n24
Expand All @@ -334,6 +385,7 @@ workflows:
ignore: stable
docker-img: 'gcr.io/gcr-for-testing/arangodb/enterprise:3.12'
topology: single
resource_class: arangodb/small-arm64-privileged
ssl: 'true'
http_proto: h2
node: n24
Expand Down Expand Up @@ -364,8 +416,30 @@ workflows:
when: <<pipeline.parameters.docker-img>>
jobs:
- node-test:
name: <<matrix.node>>-<<matrix.topology>>-ssl<<matrix.ssl>>-<<matrix.module-system>>
name: <<matrix.node>>-single-ssl<<matrix.ssl>>-<<matrix.module-system>>
context: docker-hub
topology: single
resource_class: arangodb/small-arm64-privileged
filters:
branches:
ignore: stable
matrix:
parameters:
docker-img:
- <<pipeline.parameters.docker-img>>
node:
- 'n22'
- 'n24'
ssl:
- 'true'
- 'false'
module-system:
- 'cjs'
- 'esm'
- node-test:
name: <<matrix.node>>-cluster-ssl<<matrix.ssl>>-<<matrix.module-system>>
context: docker-hub
topology: cluster
filters:
branches:
ignore: stable
Expand All @@ -376,9 +450,6 @@ workflows:
node:
- 'n22'
- 'n24'
topology:
- 'single'
- 'cluster'
ssl:
- 'true'
- 'false'
Expand All @@ -398,6 +469,7 @@ workflows:
ignore: stable
docker-img: <<pipeline.parameters.docker-img>>
topology: single
resource_class: arangodb/small-arm64-privileged
ssl: 'true'
http_proto: h1
node: n24
Expand All @@ -410,6 +482,7 @@ workflows:
ignore: stable
docker-img: <<pipeline.parameters.docker-img>>
topology: single
resource_class: arangodb/small-arm64-privileged
ssl: 'true'
http_proto: h2
node: n24
Expand All @@ -425,4 +498,27 @@ workflows:
filters:
branches:
ignore: stable
docker-img: <<pipeline.parameters.docker-img>>
docker-img: <<pipeline.parameters.docker-img>>

# Consumer TypeScript compat: build+pack once (TS 7), then typecheck the tarball with
# TS 5, TS 6, and TS 7 in parallel.
compat-typescript:
when:
not: <<pipeline.parameters.docker-img>>
jobs:
- compat-pack
- compat-consumer:
name: compat-consumer-ts5
ts: '5.4.5'
requires:
- compat-pack
- compat-consumer:
name: compat-consumer-ts6
ts: '6.0.3'
requires:
- compat-pack
- compat-consumer:
name: compat-consumer-ts7
ts: '7.0.2'
requires:
- compat-pack
16 changes: 16 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,29 @@ This driver uses semantic versioning:
on the default `globalThis.fetch` path (not only when using `config.agentOptions`) by removing
manual `Content-Length` header handling by default and letting `fetch` set it from the request body.
([#855](https://github.com/arangodb/arangojs/issues/855))
- Tests: Stream query setup inserts and parallel stream opens are chunked; multi-batch cursor
tests use a longer `ttl` to avoid intermittent CI timeouts / `cursor not found` under load.

### Added

- Added `config.forceContentLength` (default `false`). Set to `true` if you see `ECONNRESET` in
Next.js 15 production builds when using `next/headers` `cookies()` ([#831](https://github.com/arangodb/arangojs/issues/831)).
Do not enable this when using undici 8.x unless required — it restores explicit `Content-Length`
handling that can conflict with strict undici header validation.
- CI: CircleCI `compat-typescript` workflow builds/packs the driver once and typechecks the
publishable tarball as a TypeScript **5.4**, **6.0**, and **7.0** consumer (`compat-test/`).

### Changed

- CI: Single-topology and HTTP proto smoke `node-test` jobs use
`arangodb/small-arm64-privileged`; cluster jobs keep `arangodb/medium-arm64-privileged`.
- Dev: Builds use **TypeScript 7** (`@typescript/native` → `typescript@^7.0.2`) for `tsc`. The
`typescript` package is aliased to `@typescript/typescript6` so tools that still need the
TypeScript 6 programmatic API (TypeDoc, typescript-eslint) keep working until a TS 7 API ships.
- Dev: Set explicit `compilerOptions.types` (`node`, `mocha`) for TS 6/7’s stricter `@types`
handling. CJS build uses `moduleResolution: "Bundler"` with `module: "CommonJS"` (replaces
deprecated `node10` / `"Node"` resolution).
- Dev: Upgraded TypeDoc to **0.28.20** for TypeScript 6 peer compatibility (docs generation).

### Deprecated

Expand Down
6 changes: 6 additions & 0 deletions compat-test/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"name": "arangojs-compat-test",
"private": true,
"type": "module",
"description": "Consumer compatibility smoke test for published arangojs types (see the compat-typescript workflow in .circleci/config.yml)"
}
15 changes: 15 additions & 0 deletions compat-test/sample-imports.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
/**
* Minimal consumer app: typecheck only (no runtime / no ArangoDB).
* Simulates a project that depends on the published arangojs package.
*/
import arangojs, { aql, Database } from "arangojs";

const db: Database = arangojs({
url: "http://127.0.0.1:8529",
databaseName: "_system",
});

const query = aql`RETURN ${1}`;

void db;
void query;
13 changes: 13 additions & 0 deletions compat-test/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"compilerOptions": {
"target": "ES2022",
"module": "NodeNext",
"moduleResolution": "NodeNext",
"strict": true,
"noEmit": true,
"skipLibCheck": false,
"esModuleInterop": true,
"types": ["node"]
},
"include": ["sample-imports.ts"]
}
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,9 @@
"puppeteer": "^22.8.2",
"semver": "^7.6.0",
"source-map-support": "^0.5.21",
"typedoc": "^0.25.12",
"typescript": "^5.4.2",
"typedoc": "^0.28.20",
"@typescript/native": "npm:typescript@^7.0.2",
"typescript": "npm:@typescript/typescript6@^6.0.2",
"undici": "^8.2.0"
},
"peerDependencies": {
Expand Down
3 changes: 2 additions & 1 deletion src/test/08-cursors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,8 @@ describe("Batch-wise Cursor API", function () {
}
});
beforeEach(async () => {
cursor = (await db.query(aqlQuery, { batchSize: 1 })).batches;
// batchSize:1 needs many round-trips; keep cursor alive under slow CI/cluster.
cursor = (await db.query(aqlQuery, { batchSize: 1, ttl: 120 })).batches;
allCursors.push(cursor);
});
describe("for await of cursor", () => {
Expand Down
Loading