How to use the odata.etag function in odata

To help you get started, we’ve selected a few odata examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github gluwer / azure-table-node / lib / utils.js View on Github external
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;
};
github taskcluster / taskcluster / libraries / testing / lib / entity.js View on Github external
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'];
};
github taskcluster / taskcluster / libraries / testing / lib / entity.js View on Github external
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'];
};
github SharePoint / sp-dev-fx-extensions / samples / react-field-toggle / src / extensions / toggle / ToggleFieldCustomizer.ts View on Github external
.then((item: Item): Promise => {
        etag = item["odata.etag"];
        return Promise.resolve((item as any) as any);
      })
      .then((item: any): Promise => {
github SharePoint / sp-dev-fx-webparts / samples / sharepoint-crud / src / webparts / spPnPJsCrud / SpPnPJsCrudWebPart.ts View on Github external
.then((item: Item): Promise => {
        etag = item["odata.etag"];
        return Promise.resolve((item as any) as IListItem);
      })
      .then((item: IListItem): Promise => {
github taskcluster / azure-entities / src / entity.js View on Github external
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'];
};
github Azure / Azurite / lib / model / table / EntityProxy.js View on Github external
odata(mode) {
    const odata = super.odata(mode);
    if (mode === ODataMode.FULL) {
      odata["odata.etag"] = this._.odata.etag;
    }
    return odata;
  }
github taskcluster / azure-entities / src / entity.js View on Github external
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'];
};
github taskcluster / azure-entities / src / entity.js View on Github external
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'];
};
github taskcluster / azure-entities / src / inmemory.js View on Github external
}
  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);
};

odata

o.js is a isomorphic Odata Javascript library to simplify the request of data. The main goal is to build a standalone, lightweight and easy to understand Odata lib.

MIT
Latest version published 3 months ago

Package Health Score

76 / 100
Full package analysis