Skip to content

Commit 7d9240b

Browse files
Release v1.5.11
1 parent d9fcf1d commit 7d9240b

File tree

6 files changed

+48
-22
lines changed

6 files changed

+48
-22
lines changed

dist/dynamics-web-api-callbacks.js

Lines changed: 25 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/*! dynamics-web-api-callbacks v1.5.10 (c) 2019 Aleksandr Rogov */
1+
/*! dynamics-web-api-callbacks v1.5.11 (c) 2019 Aleksandr Rogov */
22
(function webpackUniversalModuleDefinition(root, factory) {
33
if(typeof exports === 'object' && typeof module === 'object')
44
module.exports = factory();
@@ -1712,15 +1712,15 @@ function DynamicsWebApi(config) {
17121712
* @param {Function} errorCallback - The function that will be passed through and be called by a failed response.
17131713
* @param {Array} [select] - Use the $select system query option to limit the properties returned.
17141714
* @param {string} [filter] - Use the $filter system query option to set criteria for which entities will be returned.
1715-
* @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.
1715+
* @param {string} [oDataLink] - Use this parameter to pass @odata.nextLink or @odata.deltaLink to return a necessary response. Pass null to retrieveMultipleOptions.
17161716
*/
1717-
this.retrieveMultiple = function (collection, successCallback, errorCallback, select, filter, nextPageLink) {
1717+
this.retrieveMultiple = function (collection, successCallback, errorCallback, select, filter, oDataLink) {
17181718

17191719
this.retrieveMultipleRequest({
17201720
collection: collection,
17211721
select: select,
17221722
filter: filter
1723-
}, successCallback, errorCallback, nextPageLink);
1723+
}, successCallback, errorCallback, oDataLink);
17241724
};
17251725

17261726
/**
@@ -1742,16 +1742,16 @@ function DynamicsWebApi(config) {
17421742
}, successCallback, errorCallback);
17431743
};
17441744

1745-
var retrieveMultipleRequest = function (request, successCallback, errorCallback, nextPageLink) {
1745+
var retrieveMultipleRequest = function (request, successCallback, errorCallback, oDataLink) {
17461746

17471747
if (!_isBatch) {
17481748
ErrorHelper.callbackParameterCheck(successCallback, "DynamicsWebApi.retrieveMultiple", "successCallback");
17491749
ErrorHelper.callbackParameterCheck(errorCallback, "DynamicsWebApi.retrieveMultiple", "errorCallback");
17501750
}
17511751

1752-
if (nextPageLink) {
1753-
ErrorHelper.stringParameterCheck(nextPageLink, 'DynamicsWebApi.retrieveMultiple', 'nextPageLink');
1754-
request.url = nextPageLink;
1752+
if (oDataLink) {
1753+
ErrorHelper.stringParameterCheck(oDataLink, 'DynamicsWebApi.retrieveMultiple', 'oDataLink');
1754+
request.url = oDataLink;
17551755
}
17561756

17571757
var onSuccess = function (response) {
@@ -1767,11 +1767,11 @@ function DynamicsWebApi(config) {
17671767
* @param {DWARequest} request - An object that represents all possible options for a current request.
17681768
* @param {Function} successCallback - The function that will be passed through and be called by a successful response.
17691769
* @param {Function} errorCallback - The function that will be passed through and be called by a failed response.
1770-
* @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.
1770+
* @param {string} [oDataLink] - Use this parameter to pass @odata.nextLink or @odata.deltaLink to return a necessary response. Pass null to retrieveMultipleOptions.
17711771
*/
17721772
this.retrieveMultipleRequest = retrieveMultipleRequest;
17731773

1774-
var _retrieveAllRequest = function (request, successCallback, errorCallback, nextPageLink, records) {
1774+
var _retrieveAllRequest = function (request, successCallback, errorCallback, oDataLink, records) {
17751775

17761776
records = records || [];
17771777

@@ -1786,7 +1786,7 @@ function DynamicsWebApi(config) {
17861786
}
17871787
};
17881788

1789-
retrieveMultipleRequest(request, internalSuccessCallback, errorCallback, nextPageLink);
1789+
retrieveMultipleRequest(request, internalSuccessCallback, errorCallback, oDataLink);
17901790
};
17911791

17921792
/**
@@ -2696,6 +2696,9 @@ function getFormattedKeyValue(keyName, value) {
26962696
case 'odata.nextLink':
26972697
newKey = 'oDataNextLink';
26982698
break;
2699+
case 'odata.deltaLink':
2700+
newKey = 'oDataDeltaLink';
2701+
break;
26992702
case DWA.Prefer.Annotations.FormattedValue:
27002703
newKey = format[0] + '_Formatted';
27012704
break;
@@ -3171,6 +3174,7 @@ module.exports = function buildPreferHeader(request, functionName, config) {
31713174
var returnRepresentation = request.returnRepresentation;
31723175
var includeAnnotations = request.includeAnnotations;
31733176
var maxPageSize = request.maxPageSize;
3177+
var trackChanges = request.trackChanges;
31743178

31753179
var prefer;
31763180

@@ -3185,12 +3189,15 @@ module.exports = function buildPreferHeader(request, functionName, config) {
31853189
if (item === DWA.Prefer.ReturnRepresentation) {
31863190
returnRepresentation = true;
31873191
}
3188-
else if (item.startsWith("odata.include-annotations=")) {
3189-
includeAnnotations = item.replace('odata.include-annotations=', '').replace(/"/g,'');
3192+
else if (item.indexOf("odata.include-annotations=") > -1) {
3193+
includeAnnotations = item.replace('odata.include-annotations=', '').replace(/"/g, '');
31903194
}
31913195
else if (item.startsWith("odata.maxpagesize=")) {
31923196
maxPageSize = item.replace('odata.maxpagesize=', '').replace(/"/g, '');
31933197
}
3198+
else if (item.indexOf("odata.track-changes") > -1) {
3199+
trackChanges = true;
3200+
}
31943201
}
31953202
}
31963203

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

3229+
if (trackChanges) {
3230+
ErrorHelper.boolParameterCheck(trackChanges, "DynamicsWebApi." + functionName, "request.trackChanges");
3231+
prefer.push('odata.track-changes');
3232+
}
3233+
32223234
return prefer.join(',');
32233235
}
32243236

dist/dynamics-web-api-callbacks.min.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/dynamics-web-api.js

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/*! dynamics-web-api v1.5.10 (c) 2019 Aleksandr Rogov */
1+
/*! dynamics-web-api v1.5.11 (c) 2019 Aleksandr Rogov */
22
(function webpackUniversalModuleDefinition(root, factory) {
33
if(typeof exports === 'object' && typeof module === 'object')
44
module.exports = factory();
@@ -836,6 +836,8 @@ if (!String.prototype.endsWith || !String.prototype.startsWith) {
836836
* @property {boolean} mergeLabels - If set to 'true', DynamicsWebApi adds a request header 'MSCRM.MergeLabels: true'. Default value is 'false'.
837837
* @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'.
838838
* @property {string} contentId - BATCH REQUESTS ONLY! Sets Content-ID header or references request in a Change Set.
839+
* @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.
840+
* @property {string} deltaLink - Delta link can be used to retrieve entity changes. Important! Change Tracking must be enabled for the entity.
839841
*/
840842

841843
/**
@@ -2226,6 +2228,9 @@ function getFormattedKeyValue(keyName, value) {
22262228
case 'odata.nextLink':
22272229
newKey = 'oDataNextLink';
22282230
break;
2231+
case 'odata.deltaLink':
2232+
newKey = 'oDataDeltaLink';
2233+
break;
22292234
case DWA.Prefer.Annotations.FormattedValue:
22302235
newKey = format[0] + '_Formatted';
22312236
break;
@@ -2991,6 +2996,7 @@ module.exports = function buildPreferHeader(request, functionName, config) {
29912996
var returnRepresentation = request.returnRepresentation;
29922997
var includeAnnotations = request.includeAnnotations;
29932998
var maxPageSize = request.maxPageSize;
2999+
var trackChanges = request.trackChanges;
29943000

29953001
var prefer;
29963002

@@ -3005,12 +3011,15 @@ module.exports = function buildPreferHeader(request, functionName, config) {
30053011
if (item === DWA.Prefer.ReturnRepresentation) {
30063012
returnRepresentation = true;
30073013
}
3008-
else if (item.startsWith("odata.include-annotations=")) {
3009-
includeAnnotations = item.replace('odata.include-annotations=', '').replace(/"/g,'');
3014+
else if (item.indexOf("odata.include-annotations=") > -1) {
3015+
includeAnnotations = item.replace('odata.include-annotations=', '').replace(/"/g, '');
30103016
}
30113017
else if (item.startsWith("odata.maxpagesize=")) {
30123018
maxPageSize = item.replace('odata.maxpagesize=', '').replace(/"/g, '');
30133019
}
3020+
else if (item.indexOf("odata.track-changes") > -1) {
3021+
trackChanges = true;
3022+
}
30143023
}
30153024
}
30163025

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

3051+
if (trackChanges) {
3052+
ErrorHelper.boolParameterCheck(trackChanges, "DynamicsWebApi." + functionName, "request.trackChanges");
3053+
prefer.push('odata.track-changes');
3054+
}
3055+
30423056
return prefer.join(',');
30433057
}
30443058

dist/dynamics-web-api.min.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "dynamics-web-api",
3-
"version": "1.5.10",
3+
"version": "1.5.11",
44
"description": "DynamicsWebApi is a Microsoft Dynamics CRM Web API helper library",
55
"keywords": [
66
"crm",

0 commit comments

Comments
 (0)