Image._deserialize() now supports stored xImage objects that do not have data yet, such as pending image-processing documents or projected image metadata.
Changes
Allow the JS Image constructor to accept null as an internal no-data placeholder.
Store data as null for that placeholder and preserve the server-provided mime_type after deserialization.
Change _deserialize() from new Image(dataValue || "") to new Image(dataValue ?? null) so missing data does not become an invalid empty string.
Keep processed image URLs and binary inputs on the existing path.
Validation
Reproduced the current failure with an equivalent JS snippet: pending {xImage:{mime_type:"image/png", index:true}} reaches new Image("") and throws Invalid data.
Verified the fixed path deserializes both a pending image with no data and a processed image with URL/chunks.
deserialize missing-data PASS
Note
Full TypeScript build was not run locally because this environment does not have tsc or onenode-js/node_modules installed.
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
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
Fixes #16.
Image._deserialize() now supports stored xImage objects that do not have data yet, such as pending image-processing documents or projected image metadata.
Changes
Validation
Note
Full TypeScript build was not run locally because this environment does not have tsc or onenode-js/node_modules installed.