diff --git a/.circleci/README.md b/.circleci/README.md index becc455b4..fcdf3963b 100644 --- a/.circleci/README.md +++ b/.circleci/README.md @@ -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 @@ -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). @@ -45,9 +46,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 <>`). +Five workflows run in parallel (`when: not <>`). ### A) `integration-single-topology` (**16** jobs) @@ -97,7 +98,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. --- @@ -112,15 +124,15 @@ All run when **`docker-img`** is set (Trigger Pipeline). They use the same **`<< | ------------------- | ----------------------------------------------- | | **Docker DB image** | `<>` | | **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:** `--ssl-` +**Naming:** `-single-ssl-` | `-cluster-ssl-` ### B) `integration-http-proto-smoke-given-db-image` (**2** jobs) @@ -183,7 +195,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 diff --git a/.circleci/config.yml b/.circleci/config.yml index f48fd1c82..b6aafd200 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -95,11 +95,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 @@ -127,7 +125,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: <> + resource_class: <> steps: - timeout - checkout @@ -215,6 +218,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: @@ -225,6 +273,7 @@ workflows: name: single-<>-ssl<>-<>-312 context: docker-hub topology: single + resource_class: arangodb/small-arm64-privileged filters: branches: ignore: stable @@ -245,6 +294,7 @@ workflows: name: single-<>-ssl<>-<>-4.0-nightly context: docker-hub topology: single + resource_class: arangodb/small-arm64-privileged filters: branches: ignore: stable @@ -344,6 +394,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 @@ -356,6 +407,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 @@ -386,8 +438,30 @@ workflows: when: <> jobs: - node-test: - name: <>-<>-ssl<>-<> + name: <>-single-ssl<>-<> context: docker-hub + topology: single + resource_class: arangodb/small-arm64-privileged + filters: + branches: + ignore: stable + matrix: + parameters: + docker-img: + - <> + node: + - 'n22' + - 'n24' + ssl: + - 'true' + - 'false' + module-system: + - 'cjs' + - 'esm' + - node-test: + name: <>-cluster-ssl<>-<> + context: docker-hub + topology: cluster filters: branches: ignore: stable @@ -398,9 +472,6 @@ workflows: node: - 'n22' - 'n24' - topology: - - 'single' - - 'cluster' ssl: - 'true' - 'false' @@ -420,6 +491,7 @@ workflows: ignore: stable docker-img: <> topology: single + resource_class: arangodb/small-arm64-privileged ssl: 'true' http_proto: h1 node: n24 @@ -432,6 +504,7 @@ workflows: ignore: stable docker-img: <> topology: single + resource_class: arangodb/small-arm64-privileged ssl: 'true' http_proto: h2 node: n24 @@ -447,4 +520,27 @@ workflows: filters: branches: ignore: stable - docker-img: <> \ No newline at end of file + 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: <> + 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 diff --git a/CHANGELOG.md b/CHANGELOG.md index 5cdc6adaa..ae89ab49b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,6 +16,23 @@ This driver uses semantic versioning: ## [Unreleased] +### Added + +- 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). + ## [10.5.0] - 2026-09-11 ### Added diff --git a/compat-test/package.json b/compat-test/package.json new file mode 100644 index 000000000..df377b266 --- /dev/null +++ b/compat-test/package.json @@ -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)" +} \ No newline at end of file diff --git a/compat-test/sample-imports.ts b/compat-test/sample-imports.ts new file mode 100644 index 000000000..fca1c18db --- /dev/null +++ b/compat-test/sample-imports.ts @@ -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; diff --git a/compat-test/tsconfig.json b/compat-test/tsconfig.json new file mode 100644 index 000000000..4e40f5794 --- /dev/null +++ b/compat-test/tsconfig.json @@ -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"] +} diff --git a/package.json b/package.json index c28be1e21..ed37f0664 100644 --- a/package.json +++ b/package.json @@ -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": { diff --git a/src/test/08-cursors.ts b/src/test/08-cursors.ts index bd30bd0e6..97f940681 100644 --- a/src/test/08-cursors.ts +++ b/src/test/08-cursors.ts @@ -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", () => { diff --git a/tsconfig.cjs.json b/tsconfig.cjs.json index 5e1ff05f2..2bded024b 100644 --- a/tsconfig.cjs.json +++ b/tsconfig.cjs.json @@ -2,7 +2,7 @@ "extends": "./tsconfig.esm.json", "compilerOptions": { "module": "CommonJS", - "moduleResolution": "Node", + "moduleResolution": "Bundler", "outDir": "./build/cjs/" } } diff --git a/typedoc.json b/typedoc.json index 35dc46d23..8c9934e01 100644 --- a/typedoc.json +++ b/typedoc.json @@ -2,6 +2,7 @@ "basePath": "./src", "cacheBust": true, "disableGit": true, + "sourceLinkTemplate": "https://github.com/arangodb/arangojs/blob/main/src/{path}#L{line}", "disableSources": false, "entryPoints": ["src"], "entryPointStrategy": "expand",