farmOS / farmOS.js

A JavaScript library for working with farmOS data structures and interacting with farmOS servers.
MIT License
17 stars 13 forks source link

Schema API #69

Closed jgaehring closed 2 years ago

jgaehring commented 2 years ago

As with #67 and #68, this contains breaking changes to the API, so I'm going to package all three for a beta.12 release. Hopefully, between these 3 PR's, there will be little need for any more breaking changes prior to the general release. :crossed_fingers:

The biggest change here, contained in 3bbc18a865111e3b8daf0ed48778a6e7752c5a81, is the use of consistent return types, so all requests to farm.schema.fetch are an object containing the data and original responses (eg, { data, fulfilled, rejected }). Calls to client.schema.fetch also now require both the entity and bundle, and just return the raw response, making it much simpler and deferring to the adapter to provide polymorphism and other ergonomics. There's another much smaller (but still breaking) change in a0492f59c76442853b8ba14d947ef76505024327, where preexisting schemata that aren't explicitly set are not removed.