Skip to content

Commit 0197a7d

Browse files
Release v1.2.5
1 parent 1a17b76 commit 0197a7d

File tree

6 files changed

+119
-15
lines changed

6 files changed

+119
-15
lines changed

dist/dwa.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/*! dwa v1.2.4 (c) 2017 Aleksandr Rogov */
1+
/*! dwa v1.2.5 (c) 2017 Aleksandr Rogov */
22
(function webpackUniversalModuleDefinition(root, factory) {
33
if(typeof exports === 'object' && typeof module === 'object')
44
module.exports = factory();

dist/dynamics-web-api-callbacks.js

Lines changed: 52 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/*! dynamics-web-api-callbacks v1.2.4 (c) 2017 Aleksandr Rogov */
1+
/*! dynamics-web-api-callbacks v1.2.5 (c) 2017 Aleksandr Rogov */
22
(function webpackUniversalModuleDefinition(root, factory) {
33
if(typeof exports === 'object' && typeof module === 'object')
44
module.exports = factory();
@@ -1525,6 +1525,23 @@ function DynamicsWebApi(config) {
15251525
}, successCallback, errorCallback, nextPageLink);
15261526
}
15271527

1528+
/**
1529+
* Sends an asynchronous request to retrieve all records.
1530+
*
1531+
* @param {string} collection - The Name of the Entity Collection.
1532+
* @param {Function} successCallback - The function that will be passed through and be called by a successful response.
1533+
* @param {Function} errorCallback - The function that will be passed through and be called by a failed response.
1534+
* @param {Array} [select] - Use the $select system query option to limit the properties returned.
1535+
* @param {string} [filter] - Use the $filter system query option to set criteria for which entities will be returned.
1536+
*/
1537+
this.retrieveAll = function (collection, successCallback, errorCallback, select, filter) {
1538+
return _retrieveAllRequest({
1539+
collection: collection,
1540+
select: select,
1541+
filter: filter
1542+
}, successCallback, errorCallback);
1543+
}
1544+
15281545
/**
15291546
* Sends an asynchronous request to retrieve records.
15301547
*
@@ -1614,7 +1631,7 @@ function DynamicsWebApi(config) {
16141631
* @param {string} [pagingCookie] - Paging cookie. For retrieving the first page, pagingCookie should be null.
16151632
* @param {string} [impersonateUserId] - A String representing the GUID value for the Dynamics 365 system user id. Impersonates the user.
16161633
*/
1617-
this.executeFetchXml = function (collection, fetchXml, successCallback, errorCallback, includeAnnotations, pageNumber, pagingCookie, impersonateUserId) {
1634+
var executeFetchXml = function (collection, fetchXml, successCallback, errorCallback, includeAnnotations, pageNumber, pagingCookie, impersonateUserId) {
16181635

16191636
ErrorHelper.stringParameterCheck(collection, "DynamicsWebApi.executeFetchXml", "collection");
16201637
ErrorHelper.stringParameterCheck(fetchXml, "DynamicsWebApi.executeFetchXml", "fetchXml");
@@ -1669,6 +1686,39 @@ function DynamicsWebApi(config) {
16691686
_sendRequest("GET", result.url + "?fetchXml=" + encodedFetchXml, null, result.headers, onSuccess, errorCallback);
16701687
}
16711688

1689+
this.fetch = this.executeFetchXml = executeFetchXml;
1690+
1691+
var _executeFetchXmlAll = function (collection, fetchXml, successCallback, errorCallback, includeAnnotations, pageNumber, pagingCookie, impersonateUserId, records) {
1692+
var records = records || [];
1693+
1694+
var internalSuccessCallback = function (response) {
1695+
records = records.concat(response.value);
1696+
1697+
if (response.PagingInfo) {
1698+
_executeFetchXmlAll(collection, fetchXml, successCallback, errorCallback, includeAnnotations, response.PagingInfo.nextPage, response.PagingInfo.cookie, impersonateUserId, records);
1699+
}
1700+
else {
1701+
successCallback({ value: records });
1702+
}
1703+
};
1704+
1705+
executeFetchXml(collection, fetchXml, internalSuccessCallback, errorCallback, includeAnnotations, pageNumber, pagingCookie, impersonateUserId);
1706+
}
1707+
1708+
/**
1709+
* Sends an asynchronous request to execute FetchXml to retrieve all records.
1710+
*
1711+
* @param {string} collection - An object that represents all possible options for a current request.
1712+
* @param {string} fetchXml - FetchXML is a proprietary query language that provides capabilities to perform aggregation.
1713+
* @param {Function} successCallback - The function that will be passed through and be called by a successful response.
1714+
* @param {Function} errorCallback - The function that will be passed through and be called by a failed response.
1715+
* @param {string} [includeAnnotations] - Use this parameter to include annotations to a result. For example: * or Microsoft.Dynamics.CRM.fetchxmlpagingcookie
1716+
* @param {string} [impersonateUserId] - A String representing the GUID value for the Dynamics 365 system user id. Impersonates the user.
1717+
*/
1718+
this.fetchAll = this.executeFetchXmlAll = function (collection, fetchXml, successCallback, errorCallback, includeAnnotations, impersonateUserId) {
1719+
return _executeFetchXmlAll(collection, fetchXml, successCallback, errorCallback, includeAnnotations, null, null, impersonateUserId);
1720+
}
1721+
16721722
/**
16731723
* Associate for a collection-valued navigation property. (1:N or N:N)
16741724
*

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: 61 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/*! dynamics-web-api v1.2.4 (c) 2017 Aleksandr Rogov */
1+
/*! dynamics-web-api v1.2.5 (c) 2017 Aleksandr Rogov */
22
(function webpackUniversalModuleDefinition(root, factory) {
33
if(typeof exports === 'object' && typeof module === 'object')
44
module.exports = factory();
@@ -1503,7 +1503,7 @@ function DynamicsWebApi(config) {
15031503
* @returns {Promise}
15041504
*/
15051505
this.countAll = function (collection, filter, select) {
1506-
return this.retrieveAllRequest({
1506+
return _retrieveAllRequest({
15071507
collection: collection,
15081508
filter: filter,
15091509
select: select
@@ -1533,7 +1533,23 @@ function DynamicsWebApi(config) {
15331533
}
15341534

15351535
/**
1536-
* Sends an asynchronous request to count records. Returns: DWA.Types.FetchXmlResponse
1536+
* Sends an asynchronous request to retrieve all records.
1537+
*
1538+
* @param {string} collection - The Name of the Entity Collection.
1539+
* @param {Array} [select] - Use the $select system query option to limit the properties returned.
1540+
* @param {string} [filter] - Use the $filter system query option to set criteria for which entities will be returned.
1541+
* @returns {Promise}
1542+
*/
1543+
this.retrieveAll = function (collection, select, filter) {
1544+
return _retrieveAllRequest({
1545+
collection: collection,
1546+
select: select,
1547+
filter: filter
1548+
});
1549+
}
1550+
1551+
/**
1552+
* Sends an asynchronous request to execute FetchXml to retrieve records. Returns: DWA.Types.FetchXmlResponse
15371553
*
15381554
* @param {string} collection - An object that represents all possible options for a current request.
15391555
* @param {string} fetchXml - FetchXML is a proprietary query language that provides capabilities to perform aggregation.
@@ -1543,14 +1559,12 @@ function DynamicsWebApi(config) {
15431559
* @param {string} [impersonateUserId] - A String representing the GUID value for the Dynamics 365 system user id. Impersonates the user.
15441560
* @returns {Promise}
15451561
*/
1546-
this.executeFetchXml = function (collection, fetchXml, includeAnnotations, pageNumber, pagingCookie, impersonateUserId) {
1562+
var executeFetchXml = function (collection, fetchXml, includeAnnotations, pageNumber, pagingCookie, impersonateUserId) {
15471563

15481564
ErrorHelper.stringParameterCheck(collection, "DynamicsWebApi.executeFetchXml", "type");
15491565
ErrorHelper.stringParameterCheck(fetchXml, "DynamicsWebApi.executeFetchXml", "fetchXml");
15501566

1551-
if (pageNumber == null) {
1552-
pageNumber = 1;
1553-
}
1567+
pageNumber = pageNumber || 1;
15541568

15551569
ErrorHelper.numberParameterCheck(pageNumber, "DynamicsWebApi.executeFetchXml", "pageNumber");
15561570
var replacementString = '$1 page="' + pageNumber + '"';
@@ -1596,6 +1610,46 @@ function DynamicsWebApi(config) {
15961610
});
15971611
}
15981612

1613+
/**
1614+
* Sends an asynchronous request to execute FetchXml to retrieve records. Returns: DWA.Types.FetchXmlResponse
1615+
*
1616+
* @param {string} collection - An object that represents all possible options for a current request.
1617+
* @param {string} fetchXml - FetchXML is a proprietary query language that provides capabilities to perform aggregation.
1618+
* @param {string} [includeAnnotations] - Use this parameter to include annotations to a result. For example: * or Microsoft.Dynamics.CRM.fetchxmlpagingcookie
1619+
* @param {number} [pageNumber] - Page number.
1620+
* @param {string} [pagingCookie] - Paging cookie. For retrieving the first page, pagingCookie should be null.
1621+
* @param {string} [impersonateUserId] - A String representing the GUID value for the Dynamics 365 system user id. Impersonates the user.
1622+
* @returns {Promise}
1623+
*/
1624+
this.fetch = this.executeFetchXml = executeFetchXml;
1625+
1626+
var _executeFetchXmlAll = function (collection, fetchXml, includeAnnotations, pageNumber, pagingCookie, impersonateUserId, records) {
1627+
var records = records || [];
1628+
1629+
return executeFetchXml(collection, fetchXml, includeAnnotations, pageNumber, pagingCookie, impersonateUserId, records).then(function (response) {
1630+
records = records.concat(response.value);
1631+
1632+
if (response.PagingInfo) {
1633+
return _executeFetchXmlAll(collection, fetchXml, includeAnnotations, response.PagingInfo.nextPage, response.PagingInfo.cookie, impersonateUserId, records);
1634+
}
1635+
1636+
return { value: records };
1637+
});
1638+
}
1639+
1640+
/**
1641+
* Sends an asynchronous request to execute FetchXml to retrieve all records.
1642+
*
1643+
* @param {string} collection - An object that represents all possible options for a current request.
1644+
* @param {string} fetchXml - FetchXML is a proprietary query language that provides capabilities to perform aggregation.
1645+
* @param {string} [includeAnnotations] - Use this parameter to include annotations to a result. For example: * or Microsoft.Dynamics.CRM.fetchxmlpagingcookie
1646+
* @param {string} [impersonateUserId] - A String representing the GUID value for the Dynamics 365 system user id. Impersonates the user.
1647+
* @returns {Promise}
1648+
*/
1649+
this.fetchAll = this.executeFetchXmlAll = function (collection, fetchXml, includeAnnotations, impersonateUserId) {
1650+
return _executeFetchXmlAll(collection, fetchXml, includeAnnotations, null, null, impersonateUserId);
1651+
}
1652+
15991653
/**
16001654
* Associate for a collection-valued navigation property. (1:N or N:N)
16011655
*

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.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.2.4",
3+
"version": "1.2.5",
44
"description": "DynamicsWebApi is a Microsoft Dynamics CRM Web API helper library",
55
"keywords": [
66
"crm",

0 commit comments

Comments
 (0)