Releases: thorgate/tg-resources
Releases · thorgate/tg-resources
Version 2.0.0-alpha.7
Version 2.0 alpha 7
2.0.0-alpha.6
TBD
2.0.0-alpha.5
TBD
2.0.0-alpha.4
TBD
2.0.0-alpha.3
TBD
2.0.0-alpha.2
TBD
2.0.0-alpha.1
- ❗ Removed deprecated
ValidationError.getFieldError
- ❗ Renamed internal
.options
(per resource/router) to.config
(see #10) - ❗
parseErrors
now gets parent config not parent instance as it's second argument - ❗
prepareErrors
now gets parent config not parent instance as it's second argument - ❗ Removed
defaultHeaders
- useheaders
ordefaultAcceptHeader
- ❗ Setting
Accept
header to undefined/null does not cause the response to be parsed
as text anymore. When migrating, just setAccept
totext/html
. - Added built-in for
OPTIONS
request:Resource.options
(see #10) - Added new configuration parameter
mutateError
(see docs) - Added
defaultAcceptHeader
(see docs) - Removed separate
tg-resources-react-native
package. Users of older
versions of it can safely update totg-resources@2.0.0
- Deterministic config merge (+ tests for it)
- Use
jsnext:main
andmodule
fields in package.json - Use
react-native
field in package.json - Update dev dependencies
- Docs: Document extra arguments of
mutateResponse
- Docs: Add call signatures for
parseErrors
- Docs: Add call signatures for
prepareError
Version 1.0.0
- Support react native (see #2)
- Error handling changes (see #3)
- No global configuration anymore
- Routers (see documentation)
- more tests
- Misc
- Use babel 6 for building
- Reduce dependency count
- Use
lodash.template
instead of depending on full lodash
Migrating to 1.0.0
-
Default export changed:
old:
import Resource from 'tg-resources';
new:
import { Resource } from 'tg-resources';
-
Global configuration was removed
Instead of using
setConfig
andgetConfig
one must set config per Resource1[1] To keep things DRY use
Router
for defining your configuration. Note: It's also possible to extendResource
which can be a better alternative in some cases. -
Configuration parameters have changed:
-
API_BASE
is nowapiRoot
-
getExtraHeaders
is nowheaders
-
getCookies
is nowcookies
-
added:
mutateResponse
prepareError
parseErrors
statusSuccess
statusValidationError
defaultHeaders
-
removed:
onSourceError
ValidationErrorExtras
see the Configuration for more info
-
-
Resource constructor changed:
old:
new Resource(apiEndpoint, expectedStatus, mutateResponse, errorStatus)
new:
new Resource(apiEndpoint, config)