azure-entities
Advanced tools
Comparing version 5.5.2 to 5.5.3
{ | ||
"name": "azure-entities", | ||
"version": "5.5.2", | ||
"version": "5.5.3", | ||
"author": "Jonas Finnemann Jensen <jopsen@gmail.com>", | ||
@@ -25,7 +25,8 @@ "description": "azure-entities", | ||
"devDependencies": { | ||
"eslint": "6.0.1", | ||
"eslint": "6.6.0", | ||
"eslint-config-taskcluster": "4.0.0", | ||
"express": "4.17.1", | ||
"mocha": "6.1.4", | ||
"sinon": "7.3.2" | ||
"mocha": "6.2.2", | ||
"sinon": "7.5.0", | ||
"taskcluster-client": "22.1.1" | ||
}, | ||
@@ -32,0 +33,0 @@ "main": "./src/entity", |
@@ -117,2 +117,4 @@ Azure Table Storage Entities | ||
Note that the arbitrary-sized property types, such as String and Blob, can result in an error with `err.code === 'PropertyTooLarge'` if the property is too large. | ||
#### Keys | ||
@@ -333,2 +335,4 @@ | ||
Note that the arbitrary-sized property types, such as String and Blob, can result in an error with `err.code === 'PropertyTooLarge'` on creation or modification if the property is too large. | ||
The `remove` method will remove a row. This can be called either as a class | ||
@@ -335,0 +339,0 @@ method (in which case the row is not loaded) or as an instance method. Both |
@@ -344,3 +344,3 @@ /* eslint-disable consistent-this */ | ||
subClass.prototype.__table === undefined, | ||
'This `Entity` subclass is already setup!' | ||
'This `Entity` subclass is already setup!', | ||
); | ||
@@ -383,3 +383,3 @@ | ||
var propertiesToLock = subClass.prototype.__partitionKey.covers.concat( | ||
subClass.prototype.__rowKey.covers | ||
subClass.prototype.__rowKey.covers, | ||
); | ||
@@ -614,3 +614,3 @@ var lockedProperties = {}; | ||
subClass.prototype.__rowKey, | ||
'Must be configured first, see `Entity.configure`' | ||
'Must be configured first, see `Entity.configure`', | ||
); | ||
@@ -626,3 +626,3 @@ | ||
subClass.prototype.__signingKey === undefined, | ||
'This `Entity` subclass is already setup!' | ||
'This `Entity` subclass is already setup!', | ||
); | ||
@@ -772,3 +772,3 @@ | ||
'ensureTable: Failed to create table \'%s\' with err: %j', | ||
ClassProps.__table | ||
ClassProps.__table, | ||
)); | ||
@@ -788,3 +788,3 @@ }; | ||
'deleteTable: Failed to delete table \'%s\' with err: %j', | ||
ClassProps.__table | ||
ClassProps.__table, | ||
)); | ||
@@ -797,3 +797,3 @@ }; | ||
*/ | ||
Entity.create = function(properties, overwriteIfExists) { | ||
Entity.create = async function(properties, overwriteIfExists) { | ||
var Class = this; | ||
@@ -845,3 +845,3 @@ var ClassProps = Class.prototype; | ||
partitionKey, | ||
rowKey | ||
rowKey, | ||
).then(wrapEntityClass(Class), function(err) { | ||
@@ -907,3 +907,3 @@ if (ignoreIfNotExists && err && err.code === 'ResourceNotFound') { | ||
this._partitionKey, | ||
this._rowKey | ||
this._rowKey, | ||
).then(function(entity) { | ||
@@ -976,3 +976,3 @@ // Deserialize a shadow object from the entity | ||
self._properties, | ||
self._properties | ||
self._properties, | ||
)).then(function() { | ||
@@ -979,0 +979,0 @@ var entityChanges = {}; // Track changes we have to upload |
@@ -183,3 +183,3 @@ | ||
return ASCENDING_KEY_PADDING.substring( | ||
0, ASCENDING_KEY_PADDING.length - str.length | ||
0, ASCENDING_KEY_PADDING.length - str.length, | ||
) + str; | ||
@@ -197,3 +197,3 @@ }; | ||
return ASCENDING_KEY_PADDING.substring( | ||
0, ASCENDING_KEY_PADDING.length - str.length | ||
0, ASCENDING_KEY_PADDING.length - str.length, | ||
) + str; | ||
@@ -200,0 +200,0 @@ }; |
@@ -26,2 +26,12 @@ | ||
var checkSize = function(property, value, maxSize) { | ||
if (value.length <= maxSize) { | ||
return; | ||
} | ||
var err = new Error('Property ' + property + ' is larger than ' + maxSize + | ||
' bytes when encoded for storage'); | ||
err.code = 'PropertyTooLarge'; | ||
throw err; | ||
}; | ||
/******************** Base Type ********************/ | ||
@@ -489,3 +499,3 @@ | ||
value = this.toBuffer(value, cryptoKey); | ||
assert(value.length <= 256 * 1024, 'Can\'t store buffers > 256kb'); | ||
checkSize(this.property, value, 256 * 1024); | ||
// We have one chunk per 64kb | ||
@@ -675,3 +685,3 @@ var chunks = Math.ceil(value.length / (64 * 1024)); | ||
'SchemaEnforcedType \'' + this.property + | ||
'\' schema validation failed: ' + ajv.errorsText(validate.errors) | ||
'\' schema validation failed: ' + ajv.errorsText(validate.errors), | ||
); | ||
@@ -712,4 +722,3 @@ err.errors = validate.errors; | ||
// Need room for initialization vector and any padding | ||
assert(plainBuffer.length <= 256 * 1024 - 32, | ||
'Can\'t store buffers > 256 * 1024 - 32 bytes'); | ||
checkSize(this.property, plainBuffer, 256 * 1024 - 32); | ||
var iv = crypto.randomBytes(16); | ||
@@ -881,3 +890,3 @@ var cipher = crypto.createCipheriv('aes-256-cbc', cryptoKey, iv); | ||
'EncryptedSchemaEnforcedType \'' + this.property + | ||
'\' schema validation failed: ' + ajv.errorsText(validate.errors) | ||
'\' schema validation failed: ' + ajv.errorsText(validate.errors), | ||
); | ||
@@ -1034,3 +1043,3 @@ err.errors = validate.errors; | ||
index * SLUGID_SIZE, | ||
(index + 1) * SLUGID_SIZE | ||
(index + 1) * SLUGID_SIZE, | ||
); | ||
@@ -1089,3 +1098,3 @@ this.avail += 1; | ||
this.getBufferView(), | ||
other.getBufferView() | ||
other.getBufferView(), | ||
) === 0; | ||
@@ -1092,0 +1101,0 @@ }; |
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
143159
2900
474
6