Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
_createResponsePayload(payload, tableName, accept, singleEntity) {
let response = {};
if (accept !== ODataMode.NONE) {
response[
"odata.metadata"
] = `http://127.0.0.1:10002/devstoreaccount1/$metadata#${tableName}`;
}
// case where we do not have an array
if (singleEntity) {
for (const item of payload) {
response["PartitionKey"] = item.partitionKey;
response["RowKey"] = item.rowKey;
response = Object.assign({}, response, item.attribs(accept));
}
} else if (payload.length === 1) {
response["PartitionKey"] = payload[0].partitionKey;
response["RowKey"] = payload[0].rowKey;
for (const attrib in payload[0].attribs(accept)) {
response[attrib] = payload[0]._.attribs[attrib];
}
.then((r) => {
// Paged collections patch
if (typeof r.body['odata.nextLink'] === 'string') {
r.body['odata.nextLink'] = this.util.buildProxyEndpointUrl(r.body['odata.nextLink']);
}
if (r.body.d && typeof r.body.d.__next === 'string') {
r.body.d.__next = this.util.buildProxyEndpointUrl(r.body.d.__next);
}
// OData patch to PnPjs chained requests work
if (typeof r.body['odata.metadata'] === 'string') {
r.body['odata.metadata'] = this.util.buildProxyEndpointUrl(r.body['odata.metadata']);
}
// OData patch to PnPjs URI resolver, Verbose mode
if (r.body?.d?.__metadata?.uri) {
r.body.d.__metadata.uri = this.util.buildProxyEndpointUrl(r.body.d.__metadata.uri);
}
return r;
})
.then((r) => this.transmitResponse(res, r))
var promise = $http(httpConfig).then(function(response) {
var data = response.data,
promise = value.$promise;
if(data && angular.isNumber(data['@odata.count'])) {
data.count = data['@odata.count'];
}
if (data && (angular.isString(data['@odata.context']) || angular.isString(data['odata.metadata']) ) && data.value && angular.isArray(data.value)) {
var fullObject = data;
data = data.value;
for (var property in fullObject) {
if (property !== "value") {
value[property] = fullObject[property];
}
}
}
if (data) {
// Need to convert action.isArray to boolean in case it is undefined
// jshint -W018
if (angular.isArray(data) !== (!isSingleElement && !! action.isArray) && !forceSingleElement) {
throw $resourceMinErr('badcfg',
'Error in resource configuration for action `{0}`. Expected response to ' +
_createResponsePayload(payload, accept) {
const response = {};
if (accept !== ODataMode.NONE) {
response['odata.metadata'] = `http://127.0.0.1:10002/devstoreaccount1/$metadata#Tables`;
}
response.value = [];
let i = 0;
for (const item of payload) {
response.value.push(item.odata(accept))
delete response.value[i]['odata.metadata'];
++i;
}
return response;
}
}
.then(function (data) {
if (data["odata.metadata"]) {
if (data["odata.count"])
count = data["odata.count"];
data = data.value;
}
else if (data.__count) {
count = data.__count;
data = data.results;
}
else if (!query) {
count = data.length;
}
return data;
})
.then(function (data) {
_createResponsePayload(payload, accept) {
const response = {};
if (accept !== ODataMode.NONE) {
response['odata.metadata'] = `http://127.0.0.1:10002/devstoreaccount1/$metadata#Tables`;
}
response.value = [];
let i = 0;
for (const item of payload) {
response.value.push(item.odata(accept))
delete response.value[i]['odata.metadata'];
++i;
}
return response;
}
}
.then(function (data) {
if (data["odata.metadata"]) {
if (data["odata.count"])
count = data["odata.count"];
data = data.value;
}
else if (data.__count) {
count = data.__count;
data = data.results;
}
else if (!query) {
count = data.length;
}
return data;
})
.then(function (data) {
.done(function (data) {
var count = -1;
if (data["odata.metadata"]) {
if (data["odata.count"])
count = data["odata.count"];
data = data.value;
}
result = foreignSet.attachOrUpdate(data);
deferred.resolve(result, count === -1 ? data.length : count);
})
.fail(deferred.reject);