Skip to content

Commit 67efdc6

Browse files
authored
chore(deps): update @apify/* packages to the new majors (#1023)
Bumps the `@apify/*` shared packages to the new stable majors (ESM-only, Node 22+, matching the v3 requirements): `consts`, `log` and `utilities` to v3. Replaces the Renovate PRs (#1020, #1021, #1022) that target master, where the ESM-only majors cannot land. The vendored zod error formatter and its test suite moved to `@apify/validations` (apify/apify-shared-js#703, released as 1.1.0), so this now depends on it and re-exports `ArgumentValidationError` from there. The shared formatter keeps all of the client's improvements and its message shapes follow the crawlee style, which no client test pinned outside the moved suite.
1 parent 9a2de8f commit 67efdc6

7 files changed

Lines changed: 881 additions & 1157 deletions

File tree

docs/public-api/apify-client.api.md

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
import type { ACT_JOB_STATUSES } from '@apify/consts';
88
import { ACTOR_JOB_STATUSES } from '@apify/consts';
99
import { ACTOR_PERMISSION_LEVEL } from '@apify/consts';
10+
import { ArgumentValidationError } from '@apify/validations';
1011
import type { AxiosInstance } from 'axios';
1112
import type { AxiosInterceptorManager } from 'axios';
1213
import type { AxiosRequestConfig } from 'axios';
@@ -27,7 +28,6 @@ import { STORAGE_OWNERSHIP_FILTER } from '@apify/consts';
2728
import type { ValueOf } from '@apify/consts';
2829
import type { ValueOf as ValueOf_2 } from 'type-fest';
2930
import type { WEBHOOK_EVENT_TYPES } from '@apify/consts';
30-
import type { z } from 'zod';
3131

3232
// @public
3333
export interface AccountAndUsageLimits extends Omit<Schemas['AccountLimits'], keyof AccountAndUsageLimitsRePointed>, AccountAndUsageLimitsRePointed {
@@ -651,11 +651,7 @@ interface ApifyResponse<T = any> extends AxiosResponse<T> {
651651
config: ApifyRequestConfig & InternalAxiosRequestConfig;
652652
}
653653

654-
// @public
655-
export class ArgumentValidationError extends Error {
656-
constructor(error: z.ZodError, value: unknown, label?: string);
657-
readonly issues: z.ZodError['issues'];
658-
}
654+
export { ArgumentValidationError }
659655

660656
// @public
661657
export interface BaseActorVersion<SourceType extends ActorSourceType> extends Omit<GeneratedVersion, keyof ActorVersionClientNarrowings | keyof ActorVersionRePointed | ActorVersionSourceLocation>, ActorVersionRePointed {

package.json

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -78,9 +78,10 @@
7878
}
7979
},
8080
"dependencies": {
81-
"@apify/consts": "^2.50.0",
82-
"@apify/log": "^2.2.6",
83-
"@apify/utilities": "^2.23.2",
81+
"@apify/consts": "^3.0.1",
82+
"@apify/log": "^3.0.1",
83+
"@apify/utilities": "^3.0.1",
84+
"@apify/validations": "^1.1.0",
8485
"@crawlee/types": "^3.3.0",
8586
"ansi-colors": "^4.1.1",
8687
"async-retry": "^1.3.3",
@@ -89,12 +90,12 @@
8990
"proxy-agent": "^6.5.0",
9091
"tslib": "^2.5.0",
9192
"type-fest": "^4.0.0",
92-
"zod": "^4.0.0"
93+
"zod": "^4.5.4"
9394
},
9495
"devDependencies": {
9596
"@apify/oxlint-config": "^0.3.0",
9697
"@apify/tsconfig": "^0.2.0",
97-
"@crawlee/puppeteer": "^3.2.2",
98+
"@crawlee/puppeteer": "4.0.0-beta.165",
9899
"@rsbuild/core": "^2.0.0",
99100
"@rsbuild/plugin-node-polyfill": "^1.3.0",
100101
"@rspack/cli": "^2.0.0",

pnpm-lock.yaml

Lines changed: 870 additions & 806 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/argument_validation_error.ts

Lines changed: 0 additions & 166 deletions
This file was deleted.

src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,6 @@ export * from './resource_clients/webhook_collection.js';
2727
export * from './resource_clients/webhook_dispatch.js';
2828
export * from './resource_clients/webhook_dispatch_collection.js';
2929
export * from './apify_api_error.js';
30-
export * from './argument_validation_error.js';
30+
export { ArgumentValidationError } from '@apify/validations';
3131
export { InvalidResponseBodyError } from './interceptors.js';
3232
export type { PaginatedList, Dictionary } from './utils.js';

src/utils.ts

Lines changed: 2 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import type { JsonValue, TypedArray } from 'type-fest';
44
import { z } from 'zod';
55

66
import type { ApifyApiError } from './apify_api_error.js';
7-
import { ArgumentValidationError } from './argument_validation_error.js';
7+
import { parseArgument } from '@apify/validations';
88
import type {
99
RequestQueueClientListRequestsOptions,
1010
RequestQueueClientListRequestsResult,
@@ -19,30 +19,7 @@ const RECORD_NOT_FOUND_TYPE = 'record-not-found';
1919
const RECORD_OR_TOKEN_NOT_FOUND_TYPE = 'record-or-token-not-found';
2020
const MIN_COMPRESS_BYTES = 1024;
2121

22-
// Zod installs its English locale as a module-level side effect but ships `"sideEffects": false`, so
23-
// any tree-shaking bundler drops it and every message degrades to a bare "Invalid input". Passing it
24-
// in per parse keeps them intact without reaching into the zod config the whole process shares.
25-
const { localeError } = z.locales.en();
26-
27-
/**
28-
* Parses `value` with `schema`, returning the typed result (with schema defaults applied).
29-
* Throws {@link ArgumentValidationError} on failure.
30-
*
31-
* The optional `label` names the interface being validated and is appended to every error line
32-
* (e.g. ``... at `memory` in `ActorStartOptions` ``).
33-
* @internal
34-
*/
35-
export function parseArgument<TValue, TSchema extends z.ZodType>(
36-
value: TValue,
37-
schema: TSchema,
38-
label?: string,
39-
): TValue & z.output<TSchema> {
40-
const result = schema.safeParse(value, { error: localeError });
41-
if (!result.success) {
42-
throw new ArgumentValidationError(result.error, value, label);
43-
}
44-
return result.data as TValue & z.output<TSchema>;
45-
}
22+
export { parseArgument };
4623

4724
/**
4825
* Accepts any non-null, non-array object as a predicate for `z.custom()`.

0 commit comments

Comments
 (0)