lore-extract-action
Advanced tools
Comparing version 0.11.0 to 0.12.0-beta.1
{ | ||
"name": "lore-extract-action", | ||
"version": "0.11.0", | ||
"version": "0.12.0-beta.1", | ||
"license": "MIT", | ||
@@ -18,3 +18,3 @@ "main": "index.js", | ||
"camel-case": "^3.0.0", | ||
"lore-generate": "^0.11.0", | ||
"lore-generate": "^0.12.0-beta.1", | ||
"bluebird": "3.1.1", | ||
@@ -21,0 +21,0 @@ "lodash": "3.10.1" |
@@ -5,2 +5,3 @@ var _ = require('lodash'); | ||
var payloadCollection = require('lore-utils').payloadCollection; | ||
var normalize = require('lore-hook-actions/lib/normalize'); | ||
@@ -26,2 +27,6 @@ /* | ||
}).then(function() { | ||
// look through all models in the collection and generate actions for any attributes | ||
// with nested data that should be normalized | ||
var actions = normalize(lore, '<%= modelName %>').collection(collection); | ||
dispatch({ | ||
@@ -32,2 +37,5 @@ type: ActionTypes.fetchPlural('<%= modelName %>'), | ||
}); | ||
// dispatch any actions created from normalizing nested data | ||
actions.forEach(dispatch); | ||
}).catch(function(response) { | ||
@@ -34,0 +42,0 @@ var error = response.data; |
@@ -5,2 +5,3 @@ var _ = require('lodash'); | ||
var payload = require('lore-utils').payload; | ||
var normalize = require('lore-hook-actions/lib/normalize'); | ||
@@ -10,3 +11,3 @@ /* | ||
*/ | ||
module.exports = function get(modelId) { | ||
module.exports = function get(modelId, query) { | ||
return function(dispatch) { | ||
@@ -17,4 +18,11 @@ var Model = lore.models.<%= modelName %>; | ||
}); | ||
query = query || {}; | ||
model.fetch().then(function() { | ||
model.fetch({ | ||
data: query | ||
}).then(function() { | ||
// look through the model and generate actions for any attributes with | ||
// nested data that should be normalized | ||
var actions = normalize(lore, '<%= modelName %>').model(model); | ||
dispatch({ | ||
@@ -24,2 +32,5 @@ type: ActionTypes.update('<%= modelName %>'), | ||
}); | ||
// dispatch any actions created from normalizing nested data | ||
actions.forEach(dispatch); | ||
}).catch(function(response) { | ||
@@ -26,0 +37,0 @@ var error = response.data; |
import _ from 'lodash'; | ||
import { ActionTypes, PayloadStates, payloadCollection } from 'lore-utils'; | ||
import normalize from 'lore-hook-actions/lib/normalize'; | ||
/* | ||
@@ -23,2 +23,6 @@ * Blueprint for Find method | ||
}).then(function() { | ||
// look through all models in the collection and generate actions for any attributes | ||
// with nested data that should be normalized | ||
const actions = normalize(lore, '<%= modelName %>').collection(collection); | ||
dispatch({ | ||
@@ -29,2 +33,5 @@ type: ActionTypes.fetchPlural('<%= modelName %>'), | ||
}); | ||
// dispatch any actions created from normalizing nested data | ||
actions.forEach(dispatch); | ||
}).catch(function(response) { | ||
@@ -31,0 +38,0 @@ const error = response.data; |
import _ from 'lodash'; | ||
import { ActionTypes, PayloadStates, payload } from 'lore-utils'; | ||
import normalize from 'lore-hook-actions/lib/normalize'; | ||
@@ -7,3 +8,3 @@ /* | ||
*/ | ||
export default function get(modelId) { | ||
export default function get(modelId, query = {}) { | ||
return function(dispatch) { | ||
@@ -15,3 +16,9 @@ const Model = lore.models.<%= modelName %>; | ||
model.fetch().then(function() { | ||
model.fetch({ | ||
data: query | ||
}).then(function() { | ||
// look through the model and generate actions for any attributes with | ||
// nested data that should be normalized | ||
var actions = normalize(lore, '<%= modelName %>').model(model); | ||
dispatch({ | ||
@@ -21,2 +28,5 @@ type: ActionTypes.update('<%= modelName %>'), | ||
}); | ||
// dispatch any actions created from normalizing nested data | ||
actions.forEach(dispatch); | ||
}).catch(function(response) { | ||
@@ -23,0 +33,0 @@ const error = response.data; |
17618
519
+ Addedlodash@4.17.21(transitive)
+ Addedlore-generate@0.12.7(transitive)
- Removedlodash@2.4.1(transitive)
- Removedlore-generate@0.11.5(transitive)
Updatedlore-generate@^0.12.0-beta.1