Skip to content

feat: download and upload snapshot offline#382

Merged
peterpeterparker merged 26 commits intomainfrom
feat/download-snapshot
Oct 3, 2025
Merged

feat: download and upload snapshot offline#382
peterpeterparker merged 26 commits intomainfrom
feat/download-snapshot

Conversation

@peterpeterparker
Copy link
Copy Markdown
Contributor

No description provided.

@peterpeterparker peterpeterparker changed the title feat: download snapshot offline feat: download and upload snapshot offline Oct 1, 2025
peterpeterparker added a commit to dfinity/icp-js-canisters that referenced this pull request Oct 3, 2025
# Motivation

When I developed support for the read and upload snapshot feature in
#1046, I was really hesitant about whether to parse/map the metadata
response. On one hand, for consistency with the other functions in the
module, we should not parse the response, since none of the other
functions do so. On the other hand, we already use custom parameters for
the exposed parts of the module, a pattern that should also apply when
implementing the upload metadata of the snapshot.

Ultimately, I decided it would be more practical for the consumer to
receive a mapped object when reading data. This way, the consumer can
simply download a value and pass the same back on upload, without having
to implement additional conversions on their side.

I validated this approach with my implementation in Juno's CLI (PR
[382](junobuild/cli#382)).

That said, I’m still not fully satisfied with it. Generally speaking, I
hope we’ll find a solution in the future that makes both inputs and
outputs consistent.

# Changes

- Define a response type to read metadata
- Add a utility to parse candid types to custom js type
- Expose new module to consumer

# Notes

I exposed the all `snapshot.response` module in `index.ts`, not just the
interface, for consistency reasons because we do so with the params.

---------

Signed-off-by: David Dal Busco <david.dalbusco@dfinity.org>
@peterpeterparker peterpeterparker marked this pull request as ready for review October 3, 2025 07:37
@peterpeterparker peterpeterparker merged commit eab5bef into main Oct 3, 2025
1 of 4 checks passed
@peterpeterparker peterpeterparker deleted the feat/download-snapshot branch October 3, 2025 07:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant