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
8 changes: 2 additions & 6 deletions docs/public-api/apify-client.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import type { ACT_JOB_STATUSES } from '@apify/consts';
import { ACTOR_JOB_STATUSES } from '@apify/consts';
import { ACTOR_PERMISSION_LEVEL } from '@apify/consts';
import { ArgumentValidationError } from '@apify/validations';
import type { AxiosInstance } from 'axios';
import type { AxiosInterceptorManager } from 'axios';
import type { AxiosRequestConfig } from 'axios';
Expand All @@ -27,7 +28,6 @@ import { STORAGE_OWNERSHIP_FILTER } from '@apify/consts';
import type { ValueOf } from '@apify/consts';
import type { ValueOf as ValueOf_2 } from 'type-fest';
import type { WEBHOOK_EVENT_TYPES } from '@apify/consts';
import type { z } from 'zod';

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

// @public
export class ArgumentValidationError extends Error {
constructor(error: z.ZodError, value: unknown, label?: string);
readonly issues: z.ZodError['issues'];
}
export { ArgumentValidationError }

// @public
export interface BaseActorVersion<SourceType extends ActorSourceType> extends Omit<GeneratedVersion, keyof ActorVersionClientNarrowings | keyof ActorVersionRePointed | ActorVersionSourceLocation>, ActorVersionRePointed {
Expand Down
11 changes: 6 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,10 @@
}
},
"dependencies": {
"@apify/consts": "^2.50.0",
"@apify/log": "^2.2.6",
"@apify/utilities": "^2.23.2",
"@apify/consts": "^3.0.1",
"@apify/log": "^3.0.1",
"@apify/utilities": "^3.0.1",
"@apify/validations": "^1.1.0",
"@crawlee/types": "^3.3.0",
"ansi-colors": "^4.1.1",
"async-retry": "^1.3.3",
Expand All @@ -89,12 +90,12 @@
"proxy-agent": "^6.5.0",
"tslib": "^2.5.0",
"type-fest": "^4.0.0",
"zod": "^4.0.0"
"zod": "^4.5.4"
},
"devDependencies": {
"@apify/oxlint-config": "^0.3.0",
"@apify/tsconfig": "^0.2.0",
"@crawlee/puppeteer": "^3.2.2",
"@crawlee/puppeteer": "4.0.0-beta.165",
"@rsbuild/core": "^2.0.0",
"@rsbuild/plugin-node-polyfill": "^1.3.0",
"@rspack/cli": "^2.0.0",
Expand Down
1,676 changes: 870 additions & 806 deletions pnpm-lock.yaml

Large diffs are not rendered by default.

166 changes: 0 additions & 166 deletions src/argument_validation_error.ts

This file was deleted.

2 changes: 1 addition & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,6 @@ export * from './resource_clients/webhook_collection.js';
export * from './resource_clients/webhook_dispatch.js';
export * from './resource_clients/webhook_dispatch_collection.js';
export * from './apify_api_error.js';
export * from './argument_validation_error.js';
export { ArgumentValidationError } from '@apify/validations';
export { InvalidResponseBodyError } from './interceptors.js';
export type { PaginatedList, Dictionary } from './utils.js';
27 changes: 2 additions & 25 deletions src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import type { JsonValue, TypedArray } from 'type-fest';
import { z } from 'zod';

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

// Zod installs its English locale as a module-level side effect but ships `"sideEffects": false`, so
// any tree-shaking bundler drops it and every message degrades to a bare "Invalid input". Passing it
// in per parse keeps them intact without reaching into the zod config the whole process shares.
const { localeError } = z.locales.en();

/**
* Parses `value` with `schema`, returning the typed result (with schema defaults applied).
* Throws {@link ArgumentValidationError} on failure.
*
* The optional `label` names the interface being validated and is appended to every error line
* (e.g. ``... at `memory` in `ActorStartOptions` ``).
* @internal
*/
export function parseArgument<TValue, TSchema extends z.ZodType>(
value: TValue,
schema: TSchema,
label?: string,
): TValue & z.output<TSchema> {
const result = schema.safeParse(value, { error: localeError });
if (!result.success) {
throw new ArgumentValidationError(result.error, value, label);
}
return result.data as TValue & z.output<TSchema>;
}
export { parseArgument };

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