Skip to content

feat!: type Actor input as plain objects, arrays of them, or raw bytes - #1099

Merged
vdusek merged 5 commits into
masterfrom
feat/actor-input-dictionary
Oct 2, 2026
Merged

vdusek merged 5 commits into
masterfrom
feat/actor-input-dictionary

Conversation

@vdusek

@vdusek vdusek commented Oct 1, 2026 •

Copy link
Copy Markdown
Contributor

ActorInput was an alias for object, so a Date, Map, Set or function compiled and then went out as a wrong body or threw. It's now Dictionary | Dictionary[] | Uint8Array, which is the type suggested in #1054 plus Uint8Array. The extra member keeps raw-bytes input compiling (a Buffer sent with a contentType, see #277 and #1078).

This is a breaking change for input declared as an interface. Interfaces get no implicit index signature, so they don't match Dictionary. The v3 migration guide shows the fix, either a type alias or a spread ({ ...input }).

A type test pins the accepted and rejected shapes.

This doesn't touch contentType, the other half of #1054. The platform still stores the INPUT record under the content type it receives.

Closes: #1054

✍️ Drafted by Claude Code

BREAKING CHANGE: `ActorInput` is `Dictionary | Dictionary[] | Uint8Array`. Input declared as an `interface`, and values such as `Date`, `Map`, `Set` or functions, no longer compile.
@vdusek vdusek added the t-tooling Issues with this label are in the ownership of the tooling team. label Oct 1, 2026
@vdusek vdusek self-assigned this Oct 1, 2026
@github-actions

github-actions Bot commented Oct 1, 2026 •

Copy link
Copy Markdown
Contributor

⚠️ There are broken links in the documentation.

See more at https://github.com/apify/apify-client-js/actions/runs/36873948690#summary-110408474249

@vdusek
vdusek marked this pull request as ready for review October 1, 2026 14:16
@vdusek
vdusek requested a review from szaganek as a code owner October 1, 2026 14:16
@vdusek
vdusek requested a review from B4nan October 1, 2026 14:16
@apify-service-account apify-service-account added the tested Temporary label used only programatically for some analytics. label Oct 1, 2026
@vdusek

vdusek commented Oct 1, 2026

Copy link
Copy Markdown
Contributor Author

@B4nan, could you please give this type a quick look (I'm not able to review it.)?

export type ActorInput = Dictionary | readonly Dictionary[] | Uint8Array | ArrayBuffer;

vs. your suggested version:

type Dictionary = Record<PropertyKey, unknown>;
type ActorInput = Dictionary | Dictionary[];

@B4nan

B4nan commented Oct 2, 2026

Copy link
Copy Markdown
Member

Your version is fine, it's a superset of what I suggested. readonly Dictionary[] still accepts mutable arrays, and the bytes have to be there because serializeBody sends them as they are. Without them you couldn't use contentType with a non-JSON input.

One nit: at runtime isBuffer lets any typed array through, while the type only allows Uint8Array. I wouldn't bother widening it.

@vdusek
vdusek merged commit 6f4eb0e into master Oct 2, 2026
11 of 13 checks passed
@vdusek
vdusek deleted the feat/actor-input-dictionary branch October 2, 2026 11:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

t-tooling Issues with this label are in the ownership of the tooling team. tested Temporary label used only programatically for some analytics.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Verify the Actor run input is typed the way we want

3 participants