Skip to content

Commit 3330ce6

Browse files
committed
Stable Version 1.0.0-alpha.3.
1 parent d8d52d4 commit 3330ce6

6 files changed

+42
-37
lines changed

CHANGELOG.md

+5
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
##### 1.0.0-alpha.3 - 19 November 2014
2+
3+
###### Breaking API changes
4+
- `queryTransform`, `serialize` and `deserialize` now take the resource definition as the first argument instead of just the resource name
5+
16
##### 1.0.0-alpha.2 - 01 November 2014
27

38
###### Backwards compatible API changes

bower.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "js-data-http",
33
"description": "http adapter for js-data.",
4-
"version": "1.0.0-alpha.2",
4+
"version": "1.0.0-alpha.3",
55
"homepage": "http://www.js-data.io/docs/dshttpadapter",
66
"repository": {
77
"type": "git",

dist/js-data-http.js

+17-17
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/**
22
* @author Jason Dobry <[email protected]>
33
* @file js-data-http.js
4-
* @version 1.0.0-alpha.2 - Homepage <http://www.js-data.iojs-data-http/>
4+
* @version 1.0.0-alpha.3 - Homepage <http://www.js-data.iojs-data-http/>
55
* @copyright (c) 2014 Jason Dobry
66
* @license MIT <https://github.com/js-data/js-data-http/blob/master/LICENSE>
77
*
@@ -1408,7 +1408,7 @@ function Defaults() {
14081408

14091409
var defaultsPrototype = Defaults.prototype;
14101410

1411-
defaultsPrototype.queryTransform = function (resourceName, params) {
1411+
defaultsPrototype.queryTransform = function (resourceConfig, params) {
14121412
return params;
14131413
};
14141414

@@ -1428,11 +1428,11 @@ defaultsPrototype.error = console ? function (a, b) {
14281428
} : function () {
14291429
};
14301430

1431-
defaultsPrototype.deserialize = function (resourceName, data) {
1431+
defaultsPrototype.deserialize = function (resourceConfig, data) {
14321432
return data ? ('data' in data ? data.data : data) : data;
14331433
};
14341434

1435-
defaultsPrototype.serialize = function (resourceName, data) {
1435+
defaultsPrototype.serialize = function (resourceConfig, data) {
14361436
return data;
14371437
};
14381438

@@ -1526,7 +1526,7 @@ dsHttpAdapterPrototype.find = function (resourceConfig, id, options) {
15261526
_this.getIdPath(resourceConfig, options, id),
15271527
options
15281528
).then(function (data) {
1529-
return (options.deserialize ? options.deserialize : _this.defaults.deserialize)(resourceConfig.name, data);
1529+
return (options.deserialize ? options.deserialize : _this.defaults.deserialize)(resourceConfig, data);
15301530
});
15311531
};
15321532

@@ -1535,14 +1535,14 @@ dsHttpAdapterPrototype.findAll = function (resourceConfig, params, options) {
15351535
options = options || {};
15361536
options.params = options.params || {};
15371537
if (params) {
1538-
params = _this.defaults.queryTransform(resourceConfig.name, params);
1538+
params = _this.defaults.queryTransform(resourceConfig, params);
15391539
deepMixIn(options.params, params);
15401540
}
15411541
return _this.GET(
15421542
_this.getAllPath(resourceConfig, options),
15431543
options
15441544
).then(function (data) {
1545-
return (options.deserialize ? options.deserialize : _this.defaults.deserialize)(resourceConfig.name, data);
1545+
return (options.deserialize ? options.deserialize : _this.defaults.deserialize)(resourceConfig, data);
15461546
});
15471547
};
15481548

@@ -1551,10 +1551,10 @@ dsHttpAdapterPrototype.create = function (resourceConfig, attrs, options) {
15511551
options = options || {};
15521552
return _this.POST(
15531553
makePath(options.basePath || this.defaults.basePath || resourceConfig.basePath, resourceConfig.getEndpoint(attrs, options)),
1554-
options.serialize ? options.serialize(resourceConfig.name, attrs) : _this.defaults.serialize(resourceConfig.name, attrs),
1554+
options.serialize ? options.serialize(resourceConfig, attrs) : _this.defaults.serialize(resourceConfig, attrs),
15551555
options
15561556
).then(function (data) {
1557-
return (options.deserialize ? options.deserialize : _this.defaults.deserialize)(resourceConfig.name, data);
1557+
return (options.deserialize ? options.deserialize : _this.defaults.deserialize)(resourceConfig, data);
15581558
});
15591559
};
15601560

@@ -1563,10 +1563,10 @@ dsHttpAdapterPrototype.update = function (resourceConfig, id, attrs, options) {
15631563
options = options || {};
15641564
return _this.PUT(
15651565
_this.getIdPath(resourceConfig, options, id),
1566-
options.serialize ? options.serialize(resourceConfig.name, attrs) : _this.defaults.serialize(resourceConfig.name, attrs),
1566+
options.serialize ? options.serialize(resourceConfig, attrs) : _this.defaults.serialize(resourceConfig, attrs),
15671567
options
15681568
).then(function (data) {
1569-
return (options.deserialize ? options.deserialize : _this.defaults.deserialize)(resourceConfig.name, data);
1569+
return (options.deserialize ? options.deserialize : _this.defaults.deserialize)(resourceConfig, data);
15701570
});
15711571
};
15721572

@@ -1575,15 +1575,15 @@ dsHttpAdapterPrototype.updateAll = function (resourceConfig, attrs, params, opti
15751575
options = options || {};
15761576
options.params = options.params || {};
15771577
if (params) {
1578-
params = _this.defaults.queryTransform(resourceConfig.name, params);
1578+
params = _this.defaults.queryTransform(resourceConfig, params);
15791579
deepMixIn(options.params, params);
15801580
}
15811581
return this.PUT(
15821582
_this.getAllPath(resourceConfig, options),
1583-
options.serialize ? options.serialize(resourceConfig.name, attrs) : _this.defaults.serialize(resourceConfig.name, attrs),
1583+
options.serialize ? options.serialize(resourceConfig, attrs) : _this.defaults.serialize(resourceConfig, attrs),
15841584
options
15851585
).then(function (data) {
1586-
return (options.deserialize ? options.deserialize : _this.defaults.deserialize)(resourceConfig.name, data);
1586+
return (options.deserialize ? options.deserialize : _this.defaults.deserialize)(resourceConfig, data);
15871587
});
15881588
};
15891589

@@ -1594,7 +1594,7 @@ dsHttpAdapterPrototype.destroy = function (resourceConfig, id, options) {
15941594
_this.getIdPath(resourceConfig, options, id),
15951595
options
15961596
).then(function (data) {
1597-
return (options.deserialize ? options.deserialize : _this.defaults.deserialize)(resourceConfig.name, data);
1597+
return (options.deserialize ? options.deserialize : _this.defaults.deserialize)(resourceConfig, data);
15981598
});
15991599
};
16001600

@@ -1603,14 +1603,14 @@ dsHttpAdapterPrototype.destroyAll = function (resourceConfig, params, options) {
16031603
options = options || {};
16041604
options.params = options.params || {};
16051605
if (params) {
1606-
params = _this.defaults.queryTransform(resourceConfig.name, params);
1606+
params = _this.defaults.queryTransform(resourceConfig, params);
16071607
deepMixIn(options.params, params);
16081608
}
16091609
return this.DEL(
16101610
_this.getAllPath(resourceConfig, options),
16111611
options
16121612
).then(function (data) {
1613-
return (options.deserialize ? options.deserialize : _this.defaults.deserialize)(resourceConfig.name, data);
1613+
return (options.deserialize ? options.deserialize : _this.defaults.deserialize)(resourceConfig, data);
16141614
});
16151615
};
16161616

0 commit comments

Comments
 (0)