155 Commits

Author SHA1 Message Date
Martin Adámek 3c2dd5cc37 chore: use typescript 7 for the packages, keep 6 for the docs build (#4058)
Bumps typescript to `^7.0.2` (native compiler) for building and
type-aware linting, together with `oxlint-tsgolint@^7.0.2001`, which
version-tracks TS 7.

The docs build stays on TS 6: typedoc needs the TypeScript JS API, which
the native compiler no longer exposes. The website keeps its own
`typescript: ^6.0.0` pin and pnpm nests that copy under
`node_modules/typedoc`, so typedoc resolves 6.x while the packages
compile with TS 7.

TS 7 also caught one real issue in the tests: `RequestList#initialize()`
is private, and the call in `request_list.test.ts` now needs the same
`@ts-expect-error` the surrounding test already uses for the private
constructor.

The api-extractor runner script also imports `typescript` for its report
parsing; that import now goes through a `typescript-v6` alias
(`npm:typescript@^6.0.0`), since the parsing needs the classic JS API
(api-extractor itself bundles its own TypeScript and is unaffected). The
regenerated reports in `docs/public-api/` pick up TS 7's single-quoted
string literal types in three packages, 4 lines total.

Same change as apify/apify-sdk-js#695. Build, docs build, type-aware
lint, test typecheck and the unit suite all pass.
2026-08-21 09:07:53 +02:00
Jan Buchar 80d7010f06 chore: Add oxlint plugin to warn about TS-private class members (#4035) 2026-08-18 17:48:53 +02:00
Vlad Frangu dd6e3b9929 chore!: unify argument validation to zod (#3935)
Replaces the remaining `ow`-based argument validation with `zod` across
all packages and reworks how validation results are consumed and
reported.

Closes #3716

- **`ow` is gone** — every argument check now goes through
`parseArgument(value, schema, label?)` from `@crawlee/utils`, backed by
shared zod schemas (`schemas`, exported via `@crawlee/utils/internal`).
The `@sapphire/shapeshift` checks in `@crawlee/fs-storage` were
converted too, so a single validation library remains.
- **Parse results are used everywhere** — option defaults moved from
destructuring into the schemas (`.default(...)`), and call sites
destructure the typed parse result. `parseArgument` returns `TValue &
z.output<TSchema>`, so call sites keep their declared TS types while
gaining the defaults.
- **Schemas are built once** — all per-call schemas are hoisted to
module scope; crawler/launcher classes build their strict options schema
once as a `static optionsSchema` next to `optionsShape`. The
`urlPatternSchema` for `include`/`exclude` lives in
`enqueue_links/shared.ts`, next to the type it validates.
- **Specific validators instead of `anyObject`** — class-typed options
use `z.instanceof(...)` (`BaseHttpClient`, `Configuration`,
`EventManager`), interface-typed ones use duck-typed `objectWithKeys`
validators (`storageBackend`, `requestManager`, `logger`, …), and
element-typed arrays use the new `schemas.arrayOf(item, 'numbers')`.

`ArgumentValidationError` (replacing ow's `ArgumentError`) renders one
line per issue: the expected type, the received type and value folded
into one clause, the offending field path, and the validated interface:

```text
// v3 (ow) — first issue only
Expected property `maxRequestRetries` to be of type `number` but received type `string` in object `HttpCrawlerOptions`

// v4 (zod) — every issue, one line each
Invalid input: expected number, received the string `many` at `maxRequestRetries` in `HttpCrawlerOptions`
Invalid input: expected an array of numbers, received the number `500` at `additionalHttpErrorStatusCodes` in `HttpCrawlerOptions`
Invalid input: expected boolean, received the string `yes` at `retryOnBlocked` in `HttpCrawlerOptions`
```

Details worth knowing:

- Union failures expand into one line per failed arm (zod's own message
is a bare "Invalid input").
- `NaN` is named as itself, an empty string renders as `''`, and arrays
name their element type (``expected an array of URL patterns``) — none
of which ow or stock zod reported.
- `new Request('https://…')` gets a targeted hint pointing at the `{ url
}` object form.
- For programmatic handling, the error exposes zod's structured output:
`error.issues` and the raw `ZodError` as a typed `cause`.

The migration is documented in the v4 upgrading guide
(`docs/upgrading/upgrading_v4.md`), including a rename-cheat-sheet
entry.

- Custom HTTP clients must now **extend `BaseHttpClient`** from
`@crawlee/http-client` rather than just implementing the interface (all
shipped clients already do; `LazyDefaultHttpClient` was converted). Same
applies to test mocks — `Object.create(BaseHttpClient.prototype)` works.
- One caveat of consuming parse results: zod object schemas return a
pruned plain copy, so options holding class instances are validated with
passthrough schemas (`z.custom`-based) to keep their prototypes — there
are comments at the relevant schemas.
- Fixes a few latent gaps surfaced along the way: `Request.state` now
accepts `RequestState.SKIPPED` (validated via `z.enum(RequestState)`),
and the publish-time catalog inlining covers `optionalDependencies`.
- `ArgumentValidationError` and its formatter are intentionally kept
close to the copy in apify/apify-client-js#986 — a follow-up may extract
them into a shared package.

---------

Co-authored-by: Martin Adámek <banan23@gmail.com>
2026-08-18 17:48:52 +02:00
Jan Buchar d53ab9b6fa chore: Improve public API snapshot generation (#3964)
closes #3946
2026-08-18 17:48:50 +02:00
Jan Buchar b9e9d9d21d chore: Hide ignored symbols in public API spec (#3915) 2026-08-18 17:48:50 +02:00
Jan Buchar 83003fbd3b chore: Exclude internal symbols from public API docs (#3882) 2026-08-18 17:48:49 +02:00
Martin Adámek 6c50d37e98 ci: exclude @crawlee/fs-storage-native from canary/pin version rewrite (#3844)
`scripts/copy.ts` rewrites the version of every `@crawlee/*` dependency
(and `crawlee`) to the monorepo version during canary publish and
`pin-versions`. But `@crawlee/fs-storage-native` is an externally
published package (pinned to `0.1.5-beta.18` in `@crawlee/fs-storage`)
that is **not** versioned in lockstep with the monorepo, so rewriting it
produced a non-existent version and broke CI publishing.

This excludes `@crawlee/fs-storage-native` from the version-rewrite loop
in both the `canary` and `pin-versions` branches.
2026-08-18 17:48:48 +02:00
Jan Buchar a72033d4c2 docs: Autogenerated public API documentation (#3798) 2026-08-18 17:48:47 +02:00
Martin Adámek cc01b18ee1 refactor: convert to native ESM
BREAKING CHANGE:

The project is now native ESM without a CJS alternative. This is fine since all supported node versions allow `require(esm)`.

Also all the dependencies are updated to the latest versions, including cheerio v1.
2026-08-18 17:48:33 +02:00
Martin Adámek abe1deeb87 fix: convert @apilink to @link on build (#2949)
Closes #2717
2025-04-29 13:24:48 +02:00
Martin Adámek 07cd2c43fc chore: update to eslint v9 (#2830) 2025-03-28 15:21:56 +01:00
Vlad Frangu 7f09d56ed5 feat: remove old docker CI (#2831)
Replaced by https://github.com/apify/apify-actor-docker/pull/149 once
merged

Bye bye old CI, welcome centralized CI in its rightful spot
2025-02-05 18:21:20 +02:00
Apify Release Bot 5e6b111e77 chore(docker): update docker state [skip ci] 2025-02-05 11:05:28 +00:00
Apify Release Bot 85b3f80696 chore(docker): update docker state [skip ci] 2025-01-31 17:05:33 +00:00
Apify Release Bot e7660c4dd8 chore(docker): update docker state [skip ci] 2025-01-27 08:17:27 +00:00
Apify Release Bot fea32cdd64 chore(docker): update docker state [skip ci] 2025-01-23 15:05:59 +00:00
Apify Release Bot 26244eb88e chore(docker): update docker state [skip ci] 2025-01-23 13:09:13 +00:00
Apify Release Bot f07cac167a chore(docker): update docker state [skip ci] 2025-01-15 10:06:21 +00:00
Apify Release Bot afbd8645a7 chore(docker): update docker state [skip ci] 2025-01-10 08:08:08 +00:00
Apify Release Bot 9a6e5f3c33 chore(docker): update docker state [skip ci] 2024-12-19 11:05:57 +00:00
Apify Release Bot 41a9a0d64b chore(docker): update docker state [skip ci] 2024-12-18 12:10:16 +00:00
Apify Release Bot 680d281210 chore(docker): update docker state [skip ci] 2024-12-12 13:12:52 +00:00
Apify Release Bot 33f37fb049 chore(docker): update docker state [skip ci] 2024-12-10 19:05:37 +00:00
Apify Release Bot 8ac141321c chore(docker): update docker state [skip ci] 2024-12-10 02:34:00 +00:00
Apify Release Bot ed5bde6f09 chore(docker): update docker state [skip ci] 2024-12-09 19:05:31 +00:00
Apify Release Bot 5570c1d976 chore(docker): update docker state [skip ci] 2024-12-04 18:08:12 +00:00
Apify Release Bot 57312d4f64 chore(docker): update docker state [skip ci] 2024-12-04 09:27:51 +00:00
Apify Release Bot 383440b9ae chore(docker): update docker state [skip ci] 2024-12-03 18:07:41 +00:00
Apify Release Bot 8f1d383327 chore(docker): update docker state [skip ci] 2024-11-21 09:06:32 +00:00
Apify Release Bot 6210c121e4 chore(docker): update docker state [skip ci] 2024-11-18 19:05:33 +00:00
Apify Release Bot 008bff8087 chore(docker): update docker state [skip ci] 2024-11-13 17:05:30 +00:00
Apify Release Bot 6b01937c19 chore(docker): update docker state [skip ci] 2024-11-07 13:09:06 +00:00
Apify Release Bot 73625b4b80 chore(docker): update docker state [skip ci] 2024-11-04 13:11:05 +00:00
Apify Release Bot 59f0e7ac73 chore(docker): update docker state [skip ci] 2024-11-04 07:45:34 +00:00
Apify Release Bot 99aa278f45 chore(docker): update docker state [skip ci] 2024-10-28 15:06:20 +00:00
Apify Release Bot 69ca3cc3f5 chore(docker): update docker state [skip ci] 2024-10-25 21:05:46 +00:00
Apify Release Bot 5df67869e5 chore(docker): update docker state [skip ci] 2024-10-16 16:05:57 +00:00
Apify Release Bot 880b7b5ef3 chore(docker): update docker state [skip ci] 2024-10-16 10:06:22 +00:00
Apify Release Bot baf78409cf chore(docker): update docker state [skip ci] 2024-10-11 06:08:05 +00:00
Apify Release Bot debe62abc9 chore(docker): update docker state [skip ci] 2024-10-10 07:06:04 +00:00
Apify Release Bot e249406ff0 chore(docker): update docker state [skip ci] 2024-10-08 13:09:44 +00:00
Apify Release Bot 7d2c88570b chore(docker): update docker state [skip ci] 2024-10-07 13:10:41 +00:00
Apify Release Bot 4266ae4526 chore(docker): update docker state [skip ci] 2024-10-04 12:37:46 +00:00
Apify Release Bot 9bac207ab7 chore(docker): update docker state [skip ci] 2024-10-02 11:05:30 +00:00
Apify Release Bot 57d024f74d chore(docker): update docker state [skip ci] 2024-09-25 10:06:37 +00:00
Apify Release Bot 24cc945d48 chore(docker): update docker state [skip ci] 2024-09-23 08:16:19 +00:00
Apify Release Bot 1364939d9f chore(docker): update docker state [skip ci] 2024-09-20 18:07:13 +00:00
Apify Release Bot f3eb99d9fa chore(docker): update docker state [skip ci] 2024-09-18 12:09:18 +00:00
Apify Release Bot 6e934e6e2c chore(docker): update docker state [skip ci] 2024-09-16 14:05:54 +00:00
Apify Release Bot d34e4e1c24 chore(docker): update docker state [skip ci] 2024-09-13 18:07:14 +00:00