Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
finalObject[key] = value;
} else {
if (type === 'Edm.Int64') {
finalObject[key] = parseInt(value, 10);
} else if (type === 'Edm.DateTime') {
finalObject[key] = new Date(value);
} else if (type === 'Edm.Binary') {
finalObject[key] = new Buffer(value, 'base64');
} else { // for all other do not convert
finalObject[key] = value;
}
}
}
if ('odata.etag' in entity) {
finalObject.__etag = entity['odata.etag'];
}
return finalObject;
};
var Entity = function(entity) {
assert(entity.PartitionKey, "entity is missing 'PartitionKey'");
assert(entity.RowKey, "entity is missing 'RowKey'");
assert(entity['odata.etag'], "entity is missing 'odata.etag'");
assert(entity.Version, "entity is missing 'Version'");
this._partitionKey = entity.PartitionKey;
this._rowKey = entity.RowKey;
this._version = entity.Version;
this._properties = this.__deserialize(entity);
this._etag = entity['odata.etag'];
};
var Entity = function(entity) {
assert(entity.PartitionKey, "entity is missing 'PartitionKey'");
assert(entity.RowKey, "entity is missing 'RowKey'");
assert(entity['odata.etag'], "entity is missing 'odata.etag'");
assert(entity.Version, "entity is missing 'Version'");
this._partitionKey = entity.PartitionKey;
this._rowKey = entity.RowKey;
this._version = entity.Version;
this._properties = this.__deserialize(entity);
this._etag = entity['odata.etag'];
};
.then((item: Item): Promise => {
etag = item["odata.etag"];
return Promise.resolve((item as any) as any);
})
.then((item: any): Promise => {
.then((item: Item): Promise => {
etag = item["odata.etag"];
return Promise.resolve((item as any) as IListItem);
})
.then((item: IListItem): Promise => {
var Entity = function(entity) {
assert(entity.PartitionKey, 'entity is missing \'PartitionKey\'');
assert(entity.RowKey, 'entity is missing \'RowKey\'');
assert(entity['odata.etag'], 'entity is missing \'odata.etag\'');
assert(entity.Version, 'entity is missing \'Version\'');
this._partitionKey = entity.PartitionKey;
this._rowKey = entity.RowKey;
this._version = entity.Version;
this._properties = this.__deserialize(entity);
this._etag = entity['odata.etag'];
};
odata(mode) {
const odata = super.odata(mode);
if (mode === ODataMode.FULL) {
odata["odata.etag"] = this._.odata.etag;
}
return odata;
}
var Entity = function(entity) {
assert(entity.PartitionKey, "entity is missing 'PartitionKey'");
assert(entity.RowKey, "entity is missing 'RowKey'");
assert(entity['odata.etag'], "entity is missing 'odata.etag'");
assert(entity.Version, "entity is missing 'Version'");
this._partitionKey = entity.PartitionKey;
this._rowKey = entity.RowKey;
this._version = entity.Version;
this._properties = this.__deserialize(entity);
this._etag = entity['odata.etag'];
};
var Entity = function(entity) {
assert(entity.PartitionKey, 'entity is missing \'PartitionKey\'');
assert(entity.RowKey, 'entity is missing \'RowKey\'');
assert(entity['odata.etag'], 'entity is missing \'odata.etag\'');
assert(entity.Version, 'entity is missing \'Version\'');
this._partitionKey = entity.PartitionKey;
this._rowKey = entity.RowKey;
this._version = entity.Version;
this._properties = this.__deserialize(entity);
this._etag = entity['odata.etag'];
};
}
if (tables[this.table][key]) {
if (options.eTag !== '*') {
if (options.eTag && options.eTag !== entityEtag(tables[this.table][key])) {
throw makeError(412, 'UpdateConditionNotSatisfied');
}
}
if (options.mode === 'replace') {
tables[this.table][key] = entity;
} else {
var existing = tables[this.table][key];
_.forIn(entity, function(val, prop) {
existing[prop] = val;
});
entity = existing;
entity['odata.etag'] = entityEtag(entity);
}
} else if (!options.eTag) {
tables[this.table][key] = entity;
} else if (options.eTag !== '*') {
throw makeError(404, 'ResourceNotFound');
}
return entityEtag(entity);
};