viewmodel
Advanced tools
Comparing version 1.3.4 to 1.4.0
@@ -49,5 +49,7 @@ 'use strict'; | ||
var obj = _.clone(entity); | ||
obj._link = {'$': 'Edm.String', '_': entity.PartitionKey._ + '#' + entity.RowKey._}; | ||
obj = _.omit(obj, 'Timestamp', 'PartitionKey', 'RowKey', '.metadata'); | ||
obj = _.omit(obj, 'PartitionKey', 'RowKey', 'Timestamp', '.metadata'); | ||
function isJsonString(str) { | ||
@@ -147,3 +149,11 @@ try { | ||
} | ||
//Id can be a 'link' : 'PartitionKey#RowKey' | ||
var PartitionKey = id; | ||
var RowKey = id; | ||
if (id.indexOf('#') > -1) { | ||
PartitionKey = id.substring(0, id.indexOf('#')) | ||
RowKey = id.substring(id.indexOf('#') + 1); | ||
} | ||
options.autoResolveProperties = true; | ||
@@ -158,4 +168,4 @@ //options.entityResolver = generateObject; | ||
self.client.retrieveEntity(self.collectionName, | ||
id, | ||
id, | ||
PartitionKey, | ||
RowKey, | ||
options, | ||
@@ -286,5 +296,6 @@ function (err, entity) { | ||
// let us use custom PartitionKey / RowKey (useful for indexing and sharding) | ||
var objDescriptor = { | ||
PartitionKey: eg.String(vm.id), | ||
RowKey: eg.String(vm.id) | ||
PartitionKey: eg.String(vm.get('PartitionKey') || vm.id), | ||
RowKey: eg.String(vm.get('RowKey') || vm.id) | ||
}; | ||
@@ -383,3 +394,3 @@ | ||
async.each(entities.entries, function (entity, callback) { | ||
self.client.deleteEntity(col, entity, function (error, response) { | ||
self.client.deleteEntity(self.collectionName, entity, function (error, response) { | ||
if (callback) callback(error); | ||
@@ -386,0 +397,0 @@ }); |
@@ -70,2 +70,21 @@ 'use strict'; | ||
if (queryOptions.sort) { | ||
var keys, values; | ||
if (_.isArray(queryOptions.sort)) { | ||
keys = []; | ||
values = []; | ||
_.each(queryOptions.sort, function (pair) { | ||
keys.push(pair[0]); | ||
values.push(pair[1]); | ||
}); | ||
vms = _.sortByOrder(vms, keys, values); | ||
} else { | ||
keys = _.keys(queryOptions.sort); | ||
values = _.map(_.values(queryOptions.sort), function (v) { | ||
return v === 1; | ||
}); | ||
vms = _.sortByOrder(vms, keys, values); | ||
} | ||
} | ||
// Map to view models | ||
@@ -72,0 +91,0 @@ vms = _.map(vms, function(data) { |
{ | ||
"author": "adrai", | ||
"name": "viewmodel", | ||
"version": "1.3.4", | ||
"version": "1.4.0", | ||
"private": false, | ||
@@ -14,8 +14,8 @@ "main": "index.js", | ||
"dependencies": { | ||
"async": "1.2.1", | ||
"async": "1.3.0", | ||
"dotty": "0.0.2", | ||
"jsondate": "0.0.1", | ||
"lodash": "3.9.3", | ||
"lodash": "3.10.0", | ||
"node-uuid": "1.4.3", | ||
"sift": "1.1.1", | ||
"sift": "2.0.0", | ||
"tolerance": "1.0.0" | ||
@@ -28,2 +28,3 @@ }, | ||
"doqmentdb": ">=0.2.7", | ||
"elasticsearch": ">=5.0.0", | ||
"expect.js": ">= 0.1.2", | ||
@@ -30,0 +31,0 @@ "mocha": ">= 1.0.1", |
@@ -213,2 +213,3 @@ # Introduction | ||
7. documentdb ([documentdb](https://github.com/Azure/azure-documentdb-node), [doqmentdb](https://github.com/a8m/doqmentdb)) | ||
8. elasticsearch ([elasticsearch] (https://github.com/elastic/elasticsearch-js)) | ||
@@ -215,0 +216,0 @@ ## own db implementation |
@@ -0,1 +1,4 @@ | ||
## [v1.4.0](https://github.com/adrai/node-viewmodel/compare/v1.3.4...v1.4.0) | ||
- added elasticsearch support | ||
## [v1.3.3](https://github.com/adrai/node-viewmodel/compare/v1.3.3...v1.3.4) | ||
@@ -2,0 +5,0 @@ - redis: replace .keys() calls with .scan() calls => scales better |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
96687
22
2660
258
10
+ Addedasync@1.3.0(transitive)
+ Addedlodash@3.10.0(transitive)
+ Addedsift@2.0.0(transitive)
- Removedasync@1.2.1(transitive)
- Removedlodash@3.9.3(transitive)
- Removedsift@1.1.1(transitive)
Updatedasync@1.3.0
Updatedlodash@3.10.0
Updatedsift@2.0.0