Skip to content

Commit

Permalink
Release v1.5.11
Browse files Browse the repository at this point in the history
  • Loading branch information
AleksandrRogov committed Oct 16, 2019
1 parent d9fcf1d commit 7d9240b
Show file tree
Hide file tree
Showing 6 changed files with 48 additions and 22 deletions.
38 changes: 25 additions & 13 deletions dist/dynamics-web-api-callbacks.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*! dynamics-web-api-callbacks v1.5.10 (c) 2019 Aleksandr Rogov */
/*! dynamics-web-api-callbacks v1.5.11 (c) 2019 Aleksandr Rogov */
(function webpackUniversalModuleDefinition(root, factory) {
if(typeof exports === 'object' && typeof module === 'object')
module.exports = factory();
Expand Down Expand Up @@ -1712,15 +1712,15 @@ function DynamicsWebApi(config) {
* @param {Function} errorCallback - The function that will be passed through and be called by a failed response.
* @param {Array} [select] - Use the $select system query option to limit the properties returned.
* @param {string} [filter] - Use the $filter system query option to set criteria for which entities will be returned.
* @param {string} [nextPageLink] - Use the value of the @odata.nextLink property with a new GET request to return the next page of data. Pass null to retrieveMultipleOptions.
* @param {string} [oDataLink] - Use this parameter to pass @odata.nextLink or @odata.deltaLink to return a necessary response. Pass null to retrieveMultipleOptions.
*/
this.retrieveMultiple = function (collection, successCallback, errorCallback, select, filter, nextPageLink) {
this.retrieveMultiple = function (collection, successCallback, errorCallback, select, filter, oDataLink) {

this.retrieveMultipleRequest({
collection: collection,
select: select,
filter: filter
}, successCallback, errorCallback, nextPageLink);
}, successCallback, errorCallback, oDataLink);
};

/**
Expand All @@ -1742,16 +1742,16 @@ function DynamicsWebApi(config) {
}, successCallback, errorCallback);
};

var retrieveMultipleRequest = function (request, successCallback, errorCallback, nextPageLink) {
var retrieveMultipleRequest = function (request, successCallback, errorCallback, oDataLink) {

if (!_isBatch) {
ErrorHelper.callbackParameterCheck(successCallback, "DynamicsWebApi.retrieveMultiple", "successCallback");
ErrorHelper.callbackParameterCheck(errorCallback, "DynamicsWebApi.retrieveMultiple", "errorCallback");
}

if (nextPageLink) {
ErrorHelper.stringParameterCheck(nextPageLink, 'DynamicsWebApi.retrieveMultiple', 'nextPageLink');
request.url = nextPageLink;
if (oDataLink) {
ErrorHelper.stringParameterCheck(oDataLink, 'DynamicsWebApi.retrieveMultiple', 'oDataLink');
request.url = oDataLink;
}

var onSuccess = function (response) {
Expand All @@ -1767,11 +1767,11 @@ function DynamicsWebApi(config) {
* @param {DWARequest} request - An object that represents all possible options for a current request.
* @param {Function} successCallback - The function that will be passed through and be called by a successful response.
* @param {Function} errorCallback - The function that will be passed through and be called by a failed response.
* @param {string} [nextPageLink] - Use the value of the @odata.nextLink property with a new GET request to return the next page of data. Pass null to retrieveMultipleOptions.
* @param {string} [oDataLink] - Use this parameter to pass @odata.nextLink or @odata.deltaLink to return a necessary response. Pass null to retrieveMultipleOptions.
*/
this.retrieveMultipleRequest = retrieveMultipleRequest;

var _retrieveAllRequest = function (request, successCallback, errorCallback, nextPageLink, records) {
var _retrieveAllRequest = function (request, successCallback, errorCallback, oDataLink, records) {

records = records || [];

Expand All @@ -1786,7 +1786,7 @@ function DynamicsWebApi(config) {
}
};

retrieveMultipleRequest(request, internalSuccessCallback, errorCallback, nextPageLink);
retrieveMultipleRequest(request, internalSuccessCallback, errorCallback, oDataLink);
};

/**
Expand Down Expand Up @@ -2696,6 +2696,9 @@ function getFormattedKeyValue(keyName, value) {
case 'odata.nextLink':
newKey = 'oDataNextLink';
break;
case 'odata.deltaLink':
newKey = 'oDataDeltaLink';
break;
case DWA.Prefer.Annotations.FormattedValue:
newKey = format[0] + '_Formatted';
break;
Expand Down Expand Up @@ -3171,6 +3174,7 @@ module.exports = function buildPreferHeader(request, functionName, config) {
var returnRepresentation = request.returnRepresentation;
var includeAnnotations = request.includeAnnotations;
var maxPageSize = request.maxPageSize;
var trackChanges = request.trackChanges;

var prefer;

Expand All @@ -3185,12 +3189,15 @@ module.exports = function buildPreferHeader(request, functionName, config) {
if (item === DWA.Prefer.ReturnRepresentation) {
returnRepresentation = true;
}
else if (item.startsWith("odata.include-annotations=")) {
includeAnnotations = item.replace('odata.include-annotations=', '').replace(/"/g,'');
else if (item.indexOf("odata.include-annotations=") > -1) {
includeAnnotations = item.replace('odata.include-annotations=', '').replace(/"/g, '');
}
else if (item.startsWith("odata.maxpagesize=")) {
maxPageSize = item.replace('odata.maxpagesize=', '').replace(/"/g, '');
}
else if (item.indexOf("odata.track-changes") > -1) {
trackChanges = true;
}
}
}

Expand Down Expand Up @@ -3219,6 +3226,11 @@ module.exports = function buildPreferHeader(request, functionName, config) {
prefer.push('odata.maxpagesize=' + maxPageSize);
}

if (trackChanges) {
ErrorHelper.boolParameterCheck(trackChanges, "DynamicsWebApi." + functionName, "request.trackChanges");
prefer.push('odata.track-changes');
}

return prefer.join(',');
}

Expand Down
4 changes: 2 additions & 2 deletions dist/dynamics-web-api-callbacks.min.js

Large diffs are not rendered by default.

20 changes: 17 additions & 3 deletions dist/dynamics-web-api.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*! dynamics-web-api v1.5.10 (c) 2019 Aleksandr Rogov */
/*! dynamics-web-api v1.5.11 (c) 2019 Aleksandr Rogov */
(function webpackUniversalModuleDefinition(root, factory) {
if(typeof exports === 'object' && typeof module === 'object')
module.exports = factory();
Expand Down Expand Up @@ -836,6 +836,8 @@ if (!String.prototype.endsWith || !String.prototype.startsWith) {
* @property {boolean} mergeLabels - If set to 'true', DynamicsWebApi adds a request header 'MSCRM.MergeLabels: true'. Default value is 'false'.
* @property {boolean} isBatch - If set to 'true', DynamicsWebApi treats a request as a part of a batch request. Call ExecuteBatch to execute all requests in a batch. Default value is 'false'.
* @property {string} contentId - BATCH REQUESTS ONLY! Sets Content-ID header or references request in a Change Set.
* @property {boolean} trackChanges - Preference header 'odata.track-changes' is used to request that a delta link be returned which can subsequently be used to retrieve entity changes.
* @property {string} deltaLink - Delta link can be used to retrieve entity changes. Important! Change Tracking must be enabled for the entity.
*/

/**
Expand Down Expand Up @@ -2226,6 +2228,9 @@ function getFormattedKeyValue(keyName, value) {
case 'odata.nextLink':
newKey = 'oDataNextLink';
break;
case 'odata.deltaLink':
newKey = 'oDataDeltaLink';
break;
case DWA.Prefer.Annotations.FormattedValue:
newKey = format[0] + '_Formatted';
break;
Expand Down Expand Up @@ -2991,6 +2996,7 @@ module.exports = function buildPreferHeader(request, functionName, config) {
var returnRepresentation = request.returnRepresentation;
var includeAnnotations = request.includeAnnotations;
var maxPageSize = request.maxPageSize;
var trackChanges = request.trackChanges;

var prefer;

Expand All @@ -3005,12 +3011,15 @@ module.exports = function buildPreferHeader(request, functionName, config) {
if (item === DWA.Prefer.ReturnRepresentation) {
returnRepresentation = true;
}
else if (item.startsWith("odata.include-annotations=")) {
includeAnnotations = item.replace('odata.include-annotations=', '').replace(/"/g,'');
else if (item.indexOf("odata.include-annotations=") > -1) {
includeAnnotations = item.replace('odata.include-annotations=', '').replace(/"/g, '');
}
else if (item.startsWith("odata.maxpagesize=")) {
maxPageSize = item.replace('odata.maxpagesize=', '').replace(/"/g, '');
}
else if (item.indexOf("odata.track-changes") > -1) {
trackChanges = true;
}
}
}

Expand Down Expand Up @@ -3039,6 +3048,11 @@ module.exports = function buildPreferHeader(request, functionName, config) {
prefer.push('odata.maxpagesize=' + maxPageSize);
}

if (trackChanges) {
ErrorHelper.boolParameterCheck(trackChanges, "DynamicsWebApi." + functionName, "request.trackChanges");
prefer.push('odata.track-changes');
}

return prefer.join(',');
}

Expand Down
4 changes: 2 additions & 2 deletions dist/dynamics-web-api.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "dynamics-web-api",
"version": "1.5.10",
"version": "1.5.11",
"description": "DynamicsWebApi is a Microsoft Dynamics CRM Web API helper library",
"keywords": [
"crm",
Expand Down

0 comments on commit 7d9240b

Please sign in to comment.