itty-durable icon indicating copy to clipboard operation
itty-durable copied to clipboard

Expose storage in state property

Open 4x4notfound opened this issue 3 years ago • 3 comments

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

4x4notfound avatar Dec 28 '22 21:12 4x4notfound

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

aarhus avatar Dec 30 '22 11:12 aarhus

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?

4x4notfound avatar Jan 03 '23 20:01 4x4notfound

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

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

aarhus avatar Jan 04 '23 16:01 aarhus