Releases: ericdowell/resource-endpoint
Releases · ericdowell/resource-endpoint
TS Target Updated to ES6 & Update Dependencies
Details on target
Change
When attempting the following:
import {
ApiMixin,
AxiosErrorMixin,
UserEndpoint,
HandleErrorMixin,
SessionCsrfCookieMixin,
FormMixin,
} from 'resource-endpoint'
class UserBase extends SessionCsrfCookieMixin(
ApiMixin(FormMixin(UserEndpoint)),
) {}
class UserQuery extends AxiosErrorMixin(UserBase) {}
export class User extends HandleErrorMixin(UserBase) {
/**
*
* @returns {UserQuery}
*/
get reactQuery() {
return new UserQuery()
}
}
An error of Uncaught TypeError: Class constructor UserBase cannot be invoked without 'new'
would occur in the browser.
Issue seems to be around classes transpiled to ES5. Mainly, that native ES6 classes cannot extend the the transpiled classes.
The problem is that the class extends native ES6 class and is transpiled to ES5 with Babel. Transpiled classes cannot extend native classes, at least without additional measures.
Revert Update Dependencies
Found the following error when using version 4.2.0:
Uncaught TypeError: Class constructor UserEndpoint cannot be invoked without 'new'
This requires some looking into to figure out what dependency version has changed the build output for ES5/commonjs. For now reverting updating dependencies.
Add AxiosErrorMixin & Update Dependencies
Update Dependencies
Update Dependencies
Update Dependencies
- Updating dependencies. 877f15c
Update Dependencies
Update Dependencies
Major Release
- Added Node.js support, previously only worked with browser builds.
- Removed static method
Endpoint.safeResponseData
. BREAKING - Removed static method
Endpoint.handleRequestError
. BREAKING - Renamed
Endpoint
endpoint
property toresource
. BREAKING - Renamed
config
toglobalOptions
,setConfig
tosetGlobalOptions
andConfig
class toOptions
. BREAKING - Added
localOptions
property andsetLocalOptions
method toEndpoint
. - Updated path usage throughout Mixins.
- Updated
Endpoint
origin
/path
properties to pull fromthis.options
. WARNING may be BREAKING depending on usage