pixl-server-storage 3.2.5 → 3.2.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/engines/SQLite.js CHANGED
@@ -393,12 +393,11 @@ module.exports = Class.create({
393
393
  this.db.run( this.commands.delete, { $key: key }, function(err) {
394
394
  // In sqlite3 callbacks `this` is special, and contains `changes`
395
395
  if (!err && !this.changes) {
396
- err = new Error("Not found");
396
+ err = new Error("Failed to delete object: " + key + ": Not found");
397
397
  err.code = "NoSuchKey";
398
398
  }
399
399
  if (err) {
400
400
  self.logError('sqlite', "Failed to delete object: " + key + ": " + err);
401
- err = new Error("Failed to delete object: " + key + ": " + err);
402
401
  return callback(err);
403
402
  }
404
403
  self.logDebug(9, "Delete complete: " + key);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pixl-server-storage",
3
- "version": "3.2.5",
3
+ "version": "3.2.7",
4
4
  "description": "A key/value/list storage component for the pixl-server framework.",
5
5
  "author": "Joseph Huckaby <jhuckaby@gmail.com>",
6
6
  "homepage": "https://github.com/jhuckaby/pixl-server-storage",
package/storage.js CHANGED
@@ -169,7 +169,7 @@ module.exports = Class.create({
169
169
  // sanity checks
170
170
  if (!value) return callback( new Error("Record value cannot be false.") );
171
171
 
172
- var isBuffer = !!value.fill;
172
+ var isBuffer = Buffer.isBuffer(value);
173
173
  if (isBuffer && !this.isBinaryKey(key)) {
174
174
  return callback( new Error("Buffer values are only allowed with keys containing file extensions, e.g. " + key + ".bin") );
175
175
  }
@@ -521,6 +521,15 @@ module.exports = Class.create({
521
521
  var self = this;
522
522
  this.logDebug(9, "Copying record: " + old_key + " to " + new_key);
523
523
 
524
+ // branch here if binary keys
525
+ if (this.isBinaryKey(old_key) && this.isBinaryKey(new_key)) {
526
+ this.getStream(old_key, function(err, stream) {
527
+ if (err) return callback(err, null);
528
+ self.putStream(new_key, stream, callback);
529
+ } );
530
+ return;
531
+ }
532
+
524
533
  // load old key
525
534
  this.get(old_key, function(err, data) {
526
535
  if (err) return callback(err, null);
package/transaction.js CHANGED
@@ -40,7 +40,7 @@ var TransStorageFunctions = {
40
40
  // binary keys not part of transaction system
41
41
  if (this.isBinaryKey(key)) return this.rawStorage.put(key, value, callback);
42
42
  if (!value) return callback( new Error("Value cannot be false.") );
43
- if (value.fill) return callback( new Error("Buffers not allowed in transactions.") );
43
+ if (Buffer.isBuffer(value)) return callback( new Error("Buffers not allowed in transactions.") );
44
44
 
45
45
  this.logDebug(9, "Storing JSON Object in transaction: " + key, this.debugLevel(10) ? value : null);
46
46
  value = JSON.stringify( value );