Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expose storage in state property #27

Open
maurerbot opened this issue Dec 28, 2022 · 3 comments
Open

Expose storage in state property #27

maurerbot opened this issue Dec 28, 2022 · 3 comments

Comments

@maurerbot
Copy link

maurerbot commented Dec 28, 2022

I would be nice to access the this.state.storage object in the proxy object.

Why?

I've migrated to itty-durable from a standard DO. Itty-durable property proxy stores everything in a data property so I can
t access my existing data properties. The storage object is there but is not exposed via types so I have to ignore the type checker and do a run time migration.

Proposal

A) If storage is not meant to be exposed don't store everything in a single data object. Or
B) expose storage by typing state argument with DurableObjectState https://github.com/kwhitley/itty-durable/blob/v1.x/src/itty-durable.js#L20

@aarhus
Copy link
Contributor

aarhus commented Dec 30, 2022

I have created a PR for this
#26

If you look at my gists, I have extended the base class to support this and to use do-taskmanager

@maurerbot
Copy link
Author

I have created a PR for this #26

If you look at my gists, I have extended the base class to support this and to use do-taskmanager

awesome, can you link the gist?

@aarhus
Copy link
Contributor

aarhus commented Jan 4, 2023

Sorry, hadn't realised that it wasn't public

https://gist.github.com/aarhus/d7d6d7e1778367994f9e33c37a08074e

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

No branches or pull requests

2 participants