Repository navigation
feat: port contentEncoding, streamed dataset export and raw-bytes log read from apify-client-js - #23
Merged
Merged
Conversation
…om JS client Ports the net effect of apify-client-js#1140, #1145, #1139/#1152 (superseded), and #1141 to this client (no OpenAPI spec change this loop): - SetRecordOptions.contentEncoding(String): upload a pre-compressed key-value store record without the client compressing it again. - DatasetClient.streamItems(...): stream a dataset export as an InputStream instead of buffering it fully (named streamItems, not a downloadItems option, since Java cannot switch a method's return type on a runtime flag - mirrors this codebase's existing LogClient.get()/stream() split). - LogClient.getAsBytes()/getAsBytes(LogOptions): read a log as raw bytes (named after Python's get_as_bytes(), for the same reason as above). - The common ApifyClientError base class (#1145) was already implemented here pre-existing (ApifyClientException); verified, no change needed. Bumps CLIENT_VERSION to 0.9.0 (API_SPEC_VERSION unchanged). Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01G3FfQf9r45KVCa5VAYAjkd
Addresses review feedback on the previous commit: - SetRecordOptions.contentEncoding is now trimmed before validating and forwarding, matching the reference client's z.string().trim().min(1) schema (previously " gzip " would have been sent as a malformed header value instead of "gzip"). - Extracted HttpClientCore.streamOrThrow(url), replacing the duplicated drain+buildApiError+throw logic in LogClient.stream and DatasetClient.streamItems with one shared implementation. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01G3FfQf9r45KVCa5VAYAjkd
downloadItems and streamItems duplicated the same four-line export-URL construction (format query param + options + mergedParams/applyToUrl), differing only in the terminal buffered-vs-streamed call. Extract a private itemsUrl(format, options) helper used by both. Addresses review item: DRY (coding rule #4) from notes.md iteration 3. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01G3FfQf9r45KVCa5VAYAjkd
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.
Summary
Ports the Java-relevant changes from the latest
apify-client-jsbatch (apify/apify-client-js#1140, #1141, #1139, #1152, #1145). No OpenAPI spec change:API_SPEC_VERSIONstaysv2-2026-10-08T073338Z.SetRecordOptions.contentEncoding(String)uploads a key-value store record that is already compressed. The client sends it asContent-Encodingand doesn't compress it again. The value is trimmed and must not be blank (apify-client-js#1140).DatasetClient.streamItems(DownloadItemsFormat, DatasetDownloadOptions)streams a dataset export as anInputStream(apify-client-js#1152, which supersedes #1139). It's a separate method rather than astreamoption ondownloadItems, because a Java method can't change its return type based on a runtime flag. This matches the existingLogClient.get()/stream()split.LogClient.getAsBytes()/getAsBytes(LogOptions)read a log as raw bytes (apify-client-js#1141).LogClient.streamandDatasetClient.streamItemsshare a newHttpClientCore.streamOrThrowhelper for error handling.downloadItemsandstreamItemsshare a privateitemsUrlhelper.apify-client-js#1145 (a common
ApifyClientErrorbase class) needed no change:ApifyClientExceptionalready fills that role, andExceptionHierarchyTestcovers it.