fix!: correct Actor version, enum and setRecord input types - #1049
Merged
Merged
Conversation
Contributor
|
See more at https://github.com/apify/apify-client-js/actions/runs/34444963658#summary-102767667306 |
vdusek
marked this pull request as ready for review
September 9, 2026 12:27
janbuchar
approved these changes
Sep 9, 2026
This was referenced Sep 10, 2026
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*
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Three of the five bullets in #526 were still open on
v3.ActorVersionSourceFile.folderand the newer build fields (buildNumber,stats.computeUnits,stats.imageSizeBytes) were already fixed there; these three were not.sourceType: 'GIT_REPO'compiles without a cast. Four positions are affected:ActorVersion.sourceType, a scheduled action'stype,ActorCollectionListOptions.sortBy, and the formatdownloadItems()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()takesKeyValueStoreRecordValue, which covers the buffers, typed arrays and streams the runtime has always uploaded. The existing buffer tests carriedas anyfor exactly that reason, and those casts are gone.Bufferisn't spelled out in the union, because it's aUint8ArrayandTypedArrayalready covers it.ActorVersionClient.update()takesActorVersionUpdateData, a partial version. The spec postsCreateOrUpdateVersionRequestwith every field optional, and the endpoint documents that it leaves untouched whatever the payload omits, soupdate({ buildTag: 'latest' }), the method's own JSDoc example, now compiles.create()keeps the full union, since the API requiresversionNumberandsourceTypethere.Issue
Closes #526
Breaking changes
ActorSourceType,ScheduleActions,ActorListSortByorDownloadItemsFormatno longer accepts the matching value read off a client. Annotate it asActorVersion['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.✍️ Drafted by Claude Code