rest-client-sdk
Advanced tools
Comparing version 2.0.0-rc.1 to 2.0.0-rc.2
@@ -5,2 +5,7 @@ # Changelog | ||
## 2.0.0-rc.2 | ||
### Changed | ||
* `ONE_TO_MANY` and `MANY_TO_ONE` constant are now exported via the `Relation.ONE_TO_MANY` and `Relation.MANY_TO_ONE`, not in the main package | ||
## 2.0.0-rc.1 | ||
@@ -7,0 +12,0 @@ |
{ | ||
"name": "rest-client-sdk", | ||
"version": "2.0.0-rc.1", | ||
"version": "2.0.0-rc.2", | ||
"description": "Rest Client SDK for API", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
@@ -18,3 +18,3 @@ # Mapado Rest Client JS SDK [![Build Status](https://travis-ci.org/mapado/rest-client-js-sdk.svg?branch=master)](https://travis-ci.org/mapado/rest-client-js-sdk) [![Greenkeeper badge](https://badges.greenkeeper.io/mapado/rest-client-js-sdk.svg)](https://greenkeeper.io/) | ||
```js | ||
import { Mapping, Attribute, Relation, ClassMetadata, MANY_TO_ONE, ONE_TO_MANY } from 'rest-client-sdk'; | ||
import { Mapping, Attribute, Relation, ClassMetadata } from 'rest-client-sdk'; | ||
@@ -38,3 +38,3 @@ const mapping = new Mapping('/v1'); | ||
productMetadata.setRelationList([ | ||
new Relation('categoryList', ONE_TO_MANY), | ||
new Relation('categoryList', Relation.ONE_TO_MANY), | ||
]); | ||
@@ -48,3 +48,3 @@ | ||
categoryMetadata.setRelationList([ | ||
new Relation('product', MANY_TO_ONE), | ||
new Relation('product', Relation.MANY_TO_ONE), | ||
]); | ||
@@ -51,0 +51,0 @@ |
@@ -20,3 +20,3 @@ import RestClientSdk from './RestClientSdk'; | ||
import Attribute from './Mapping/Attribute'; | ||
import Relation, { ONE_TO_MANY, MANY_TO_ONE } from './Mapping/Relation'; | ||
import Relation from './Mapping/Relation'; | ||
@@ -42,4 +42,2 @@ export default RestClientSdk; | ||
Relation, | ||
ONE_TO_MANY, | ||
MANY_TO_ONE, | ||
}; |
@@ -1,4 +0,1 @@ | ||
const ONE_TO_MANY = 'ONE_TO_MANY'; | ||
const MANY_TO_ONE = 'MANY_TO_ONE'; | ||
class Relation { | ||
@@ -13,11 +10,13 @@ constructor(type, relationKey, serializedKey /* , targetEntity */) { | ||
isOneToMany() { | ||
return this.type === ONE_TO_MANY; | ||
return this.type === Relation.ONE_TO_MANY; | ||
} | ||
isManyToOne() { | ||
return this.type === MANY_TO_ONE; | ||
return this.type === Relation.MANY_TO_ONE; | ||
} | ||
} | ||
Relation.ONE_TO_MANY = 'ONE_TO_MANY'; | ||
Relation.MANY_TO_ONE = 'MANY_TO_ONE'; | ||
export default Relation; | ||
export { ONE_TO_MANY, MANY_TO_ONE }; |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
1852805
19857