Skip to content

Commit cc831b6

Browse files
added new impersonate to callbacks library; updated readme and ignore files
1 parent 1b14388 commit cc831b6

File tree

6 files changed

+20
-8
lines changed

6 files changed

+20
-8
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -253,6 +253,7 @@ ModelManifest.xml
253253
/scripts
254254
/coverage
255255
/tests/browser
256+
*.d.ts.map
256257

257258
# Webstorm
258259
.idea

.npmignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,6 @@ obj
88
.ntvs_analysis.dat
99

1010
# Exclude type definitions for callbacks version
11-
/types/dynamics-web-api-callbacks.d.ts
11+
/types/dynamics-web-api-callbacks.d.ts
12+
13+
*.d.ts.map

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ dynamicsWebApi.setConfig({ webApiVersion: '8.2' });
200200
Property Name | Type | Description
201201
------------ | ------------- | -------------
202202
impersonate | String | A String representing the GUID value for the Dynamics 365 system user id. Impersonates the user.
203-
impersonateAAD | String | A String representing the GUID value for the Azure active directory object id. Impersonates the user.
203+
impersonateAAD | String | `v.1.6.12+` A String representing the GUID value for the Azure active directory object id. Impersonates the user. [More Info](https://docs.microsoft.com/en-us/powerapps/developer/common-data-service/webapi/impersonate-another-user-web-api)
204204
includeAnnotations | String | Defaults Prefer header with value "odata.include-annotations=" and the specified annotation. Annotations provide additional information about lookups, options sets and other complex attribute types.
205205
maxPageSize | Number | Defaults the odata.maxpagesize preference. Use to set the number of entities returned in the response.
206206
onTokenRefresh | Function | A callback function that triggered when DynamicsWebApi requests a new OAuth token. (At this moment it is done before each call to Dynamics 365, as [recommended by Microsoft](https://msdn.microsoft.com/en-ca/library/gg327838.aspx#Anchor_2)).
@@ -252,7 +252,7 @@ id | String | `retrieveRequest`, `createRequest`, `updateRequest`, `upsertReques
252252
ifmatch | String | `retrieveRequest`, `updateRequest`, `upsertRequest`, `deleteRequest` | Sets If-Match header value that enables to use conditional retrieval or optimistic concurrency in applicable requests. [More Info](https://msdn.microsoft.com/en-us/library/mt607711.aspx)
253253
ifnonematch | String | `retrieveRequest`, `upsertRequest` | Sets If-None-Match header value that enables to use conditional retrieval in applicable requests. [More Info](https://msdn.microsoft.com/en-us/library/mt607711.aspx).
254254
impersonate | String | All | A String representing the GUID value for the Dynamics 365 system user id. Impersonates the user.
255-
impersonateAAD | String | All | A String representing the GUID value for the Azure active directory object id. Impersonates the user.
255+
impersonateAAD | String | All | `v.1.6.12+` A String representing the GUID value for the Azure active directory object id. Impersonates the user. [More Info](https://docs.microsoft.com/en-us/powerapps/developer/common-data-service/webapi/impersonate-another-user-web-api)
256256
includeAnnotations | String | `retrieveRequest`, `retrieveMultipleRequest`, `retrieveAllRequest`, `createRequest`, `updateRequest`, `upsertRequest` | Sets Prefer header with value "odata.include-annotations=" and the specified annotation. Annotations provide additional information about lookups, options sets and other complex attribute types.
257257
key | String | `retrieveRequest`, `createRequest`, `updateRequest`, `upsertRequest`, `deleteRequest` | `v.1.3.4+` A String representing collection record's Primary Key (GUID) or Alternate Key(s).
258258
maxPageSize | Number | `retrieveMultipleRequest`, `retrieveAllRequest` | Sets the odata.maxpagesize preference value to request the number of entities returned in the response.

lib/dynamics-web-api-callbacks.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,8 @@ function DynamicsWebApi(config) {
107107
var _internalConfig = {
108108
webApiVersion: "8.0",
109109
webApiUrl: "",
110-
impersonate: null,
110+
impersonate: null,
111+
impersonateAAD: null,
111112
onTokenRefresh: null,
112113
includeAnnotations: null,
113114
maxPageSize: null,
@@ -147,7 +148,11 @@ function DynamicsWebApi(config) {
147148

148149
if (config.impersonate) {
149150
_internalConfig.impersonate = ErrorHelper.guidParameterCheck(config.impersonate, "DynamicsWebApi.setConfig", "config.impersonate");
150-
}
151+
}
152+
153+
if (config.impersonateAAD) {
154+
_internalConfig.impersonateAAD = ErrorHelper.guidParameterCheck(config.impersonateAAD, "DynamicsWebApi.setConfig", "config.impersonateAAD");
155+
}
151156

152157
if (config.onTokenRefresh) {
153158
ErrorHelper.callbackParameterCheck(config.onTokenRefresh, "DynamicsWebApi.setConfig", "config.onTokenRefresh");

types/dynamics-web-api-callbacks.d.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Type definitions for dynamics-web-api-callbacks v1.6.11
1+
// Type definitions for dynamics-web-api-callbacks v1.6.12
22
// Project: https://github.com/AleksandrRogov/DynamicsWebApi
33
// Definitions by: Aleksandr Rogov https://github.com/AleksandrRogov/
44

@@ -562,6 +562,8 @@ declare namespace DynamicsWebApi {
562562
async?: boolean;
563563
/**Impersonates the user.A String representing the GUID value for the Dynamics 365 system user id. */
564564
impersonate?: string;
565+
/**Impersonates the user.A String representing the GUID value for the Azure active directory object id. */
566+
impersonateAAD?: string;
565567
/** If set to 'true', DynamicsWebApi adds a request header 'Cache-Control: no-cache'.Default value is 'false'. */
566568
noCache?: boolean;
567569
/** Authorization Token. If set, onTokenRefresh will not be called. */
@@ -692,8 +694,10 @@ declare namespace DynamicsWebApi {
692694
webApiUrl?: string;
693695
/**The version of Web API to use, for example: "8.1" */
694696
webApiVersion?: string;
695-
/**A String representing a URL to Web API(webApiVersion not required if webApiUrl specified)[not used inside of CRM] */
697+
/**A String representing a GUID value for the Dynamics 365 system user id */
696698
impersonate?: string;
699+
/**Impersonates the user. A String representing the GUID value for the Azure active directory object id. */
700+
impersonateAAD?: string;
697701
/**A function that is called when a security token needs to be refreshed. */
698702
onTokenRefresh?: (callback: OnTokenAcquiredCallback) => void;
699703
/**Sets Prefer header with value "odata.include-annotations=" and the specified annotation.Annotations provide additional information about lookups, options sets and other complex attribute types.*/

types/dynamics-web-api.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Type definitions for dynamics-web-api v1.6.11
1+
// Type definitions for dynamics-web-api v1.6.12
22
// Project: https://github.com/AleksandrRogov/DynamicsWebApi/
33
// Definitions by: Aleksandr Rogov https://github.com/AleksandrRogov/
44

0 commit comments

Comments
 (0)