From 16b959b897df29309ae568200ac4532ccdaaf5e2 Mon Sep 17 00:00:00 2001 From: Andrew Worcester Date: Wed, 2 Dec 2015 11:18:04 -0500 Subject: [PATCH] implemented _links property to hold link and relationship links while not breaking the _relationships array interface --- dist/jsonapi-datastore.js | 7 ++++++- dist/jsonapi-datastore.min.js | 2 +- dist/ng-jsonapi-datastore.js | 7 ++++++- dist/ng-jsonapi-datastore.min.js | 2 +- dist/node-jsonapi-datastore.js | 17 ++++++++++++----- dist/node-jsonapi-datastore.min.js | 2 +- src/jsonapi-datastore.js | 7 ++++++- 7 files changed, 33 insertions(+), 11 deletions(-) diff --git a/dist/jsonapi-datastore.js b/dist/jsonapi-datastore.js index 9ef1874..fddfe59 100644 --- a/dist/jsonapi-datastore.js +++ b/dist/jsonapi-datastore.js @@ -199,6 +199,10 @@ var JsonApiDataStore = (function () { model[key] = rec.attributes[key]; } + if (rec.links) { + model._links = rec.links; + } + if (rec.relationships) { for (key in rec.relationships) { var rel = rec.relationships[key]; @@ -213,7 +217,8 @@ var JsonApiDataStore = (function () { } } if (rel.links) { - console.log("Warning: Links not implemented yet."); + model._links = model._links || {}; + model._links[key] = rel.links; } } } diff --git a/dist/jsonapi-datastore.min.js b/dist/jsonapi-datastore.min.js index c02ccaf..92ad4dd 100644 --- a/dist/jsonapi-datastore.min.js +++ b/dist/jsonapi-datastore.min.js @@ -1 +1 @@ -"use strict";function _classCallCheck(t,i){if(!(t instanceof i))throw new TypeError("Cannot call a class as a function")}var _createClass=function(){function t(t,i){for(var e=0;e