Is it possible to create a js data resource definition using the TypeScript class?
In general, I would like to have full input support for computed method definitions and instance instances.
What would be surprising is something like this:
class SomeModel { public someBusinessModelValue = 'foo'; public someMoreValues = 'bar'; public get someComputedProperty() { return this.someBusinessModelValue + someMoreValues; } public instanceMethod(param: string) { return this.someMoveValues.search(param); } }
and then
DS.defineResource(fromClass('name', '/endpoint', 'idAttr', SomeModel));
or go even further and define it as
class SomeModelStore extends SomeModel { name = 'name'; endpoint = 'endpoint'; idAttribute = 'idAttr'; relations = {
and use it like
DS.defineResource(SomeModelStore);
Please note that these are just some thoughts on what I hope this will look like, I know that it probably does not work exactly like that.
source share