Skip to content

fix!: correct Actor version, enum and setRecord input types - #1049

Merged
vdusek merged 6 commits into
v3from
fix/actor-version-types
Sep 10, 2026
Merged

vdusek merged 6 commits into
v3from
fix/actor-version-types

Conversation

@vdusek

@vdusek vdusek commented Sep 9, 2026 •

Copy link
Copy Markdown
Contributor

Description

Three of the five bullets in #526 were still open on v3. ActorVersionSourceFile.folder and the newer build fields (buildNumber, stats.computeUnits, stats.imageSizeBytes) were already fixed there; these three were not.

  • Inputs that took a published enum now take that enum's values as plain string literals, so sourceType: 'GIT_REPO' compiles without a cast. Four positions are affected: ActorVersion.sourceType, a scheduled action's type, ActorCollectionListOptions.sortBy, and the format downloadItems() takes. All four enums stay published and their members stay assignable, and the version union still rejects a source location that doesn't match the declared type.
  • setRecord() takes KeyValueStoreRecordValue, which covers the buffers, typed arrays and streams the runtime has always uploaded. The existing buffer tests carried as any for exactly that reason, and those casts are gone. Buffer isn't spelled out in the union, because it's a Uint8Array and TypedArray already covers it.
  • ActorVersionClient.update() takes ActorVersionUpdateData, a partial version. The spec posts CreateOrUpdateVersionRequest with every field optional, and the endpoint documents that it leaves untouched whatever the payload omits, so update({ buildTag: 'latest' }), the method's own JSDoc example, now compiles. create() keeps the full union, since the API requires versionNumber and sourceType there.

Issue

Closes #526

Breaking changes

  • A variable annotated as ActorSourceType, ScheduleActions, ActorListSortBy or DownloadItemsFormat no longer accepts the matching value read off a client. Annotate it as ActorVersion['sourceType'], and so on, or leave it to inference. setRecord() also rejects an unsupported value with a new message, Expected a JSON-serializable value, binary data, or a stream.
  • The v3 upgrading guide and the public API report are updated to match.

✍️ Drafted by Claude Code

@vdusek vdusek added the t-tooling Issues with this label are in the ownership of the tooling team. label Sep 9, 2026
@vdusek vdusek self-assigned this Sep 9, 2026
@github-actions

github-actions Bot commented Sep 9, 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/34444963658#summary-102767667306

@vdusek vdusek changed the title fix!: correct Actor version and setRecord input types fix!: correct Actor version, enum and setRecord input types Sep 9, 2026
@vdusek
vdusek requested a review from janbuchar September 9, 2026 12:27
@vdusek
vdusek marked this pull request as ready for review September 9, 2026 12:27
@vdusek
vdusek requested a review from szaganek as a code owner September 9, 2026 12:27

@janbuchar janbuchar left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Comment thread src/models.ts Outdated
Comment thread test/actors.test.ts Outdated
@vdusek
vdusek merged commit fd02dce into v3 Sep 10, 2026
8 checks passed
@vdusek
vdusek deleted the fix/actor-version-types branch September 10, 2026 06:27
B4nan pushed a commit that referenced this pull request Sep 30, 2026
### Description

Three of the five bullets in #526 were still open on `v3`.
`ActorVersionSourceFile.folder` and the newer build fields
(`buildNumber`, `stats.computeUnits`, `stats.imageSizeBytes`) were
already fixed there; these three were not.

- Inputs that took a published enum now take that enum's values as plain
string literals, so `sourceType: 'GIT_REPO'` compiles without a cast.
Four positions are affected: `ActorVersion.sourceType`, a scheduled
action's `type`, `ActorCollectionListOptions.sortBy`, and the format
`downloadItems()` takes. All four enums stay published and their members
stay assignable, and the version union still rejects a source location
that doesn't match the declared type.
- `setRecord()` takes `KeyValueStoreRecordValue`, which covers the
buffers, typed arrays and streams the runtime has always uploaded. The
existing buffer tests carried `as any` for exactly that reason, and
those casts are gone. `Buffer` isn't spelled out in the union, because
it's a `Uint8Array` and `TypedArray` already covers it.
- `ActorVersionClient.update()` takes `ActorVersionUpdateData`, a
partial version. The spec posts `CreateOrUpdateVersionRequest` with
every field optional, and the endpoint documents that it leaves
untouched whatever the payload omits, so `update({ buildTag: 'latest'
})`, the method's own JSDoc example, now compiles. `create()` keeps the
full union, since the API requires `versionNumber` and `sourceType`
there.

### Issue

Closes #526

### Breaking changes

- A variable annotated as `ActorSourceType`, `ScheduleActions`,
`ActorListSortBy` or `DownloadItemsFormat` no longer accepts the
matching value read off a client. Annotate it as
`ActorVersion['sourceType']`, and so on, or leave it to inference.
`setRecord()` also rejects an unsupported value with a new message,
`Expected a JSON-serializable value, binary data, or a stream`.
- The v3 upgrading guide and the public API report are updated to match.

*✍️ Drafted by Claude Code*
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.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants