-
Notifications
You must be signed in to change notification settings - Fork 69
Closed
Labels
Description
Creating new resources with @tomic/lib is currently very unintuitive, to create a resource you need to "fetch" or "get" a resource but tell the store it is new. It also doesn't set any properties so you can't directly save it.
We should have a separate function to create new resources e.g. store.newResource(). Ideally this also takes a class(es) and parent because you have to set those on all resources anyway.
Something like
const resource = store.newResource('https://my-folder', dataBrowser.classes.folder, 'https://my-parent');Alternatively we could add an overload to the Resource constructor e.g.
const resource = new Resource('https://my-folder', dataBrowser.classes.folder, 'https://my-parent');Maybe we can add a way to quickly set additional properties too
joepio