@microsoft/microsoft-graph-client
Advanced tools
Comparing version 1.3.0 to 1.4.0
## Changelog | ||
### 1.3.0 | ||
New Features | ||
* Support for Large File upload [[#1](https://developer.microsoft.com/en-us/graph/docs/api-reference/v1.0/api/driveitem_createuploadsession), [#2](https://github.com/microsoftgraph/msgraph-sdk-javascript/blob/dev/docs/tasks/LargeFileUploadTask.md)] | ||
* Batching made easy [[#1](https://developer.microsoft.com/en-us/graph/docs/concepts/json_batching), [#2](https://github.com/microsoftgraph/msgraph-sdk-javascript/blob/dev/docs/content/Batching.md)] | ||
Bug Fixes | ||
* https://github.com/microsoftgraph/msgraph-sdk-javascript/issues/97 | ||
* https://github.com/microsoftgraph/msgraph-sdk-javascript/issues/110 | ||
* https://github.com/microsoftgraph/msgraph-sdk-javascript/issues/39 | ||
* https://github.com/microsoftgraph/msgraph-sdk-javascript/issues/111 | ||
### 1.2.0 | ||
@@ -4,0 +15,0 @@ Updates |
@@ -10,3 +10,3 @@ export declare let oDataQueryNames: string[]; | ||
*/ | ||
export declare const PACKAGE_VERSION = "1.2.0"; | ||
export declare const PACKAGE_VERSION = "1.4.0"; | ||
/** | ||
@@ -18,3 +18,3 @@ * @interface | ||
export interface AuthProviderCallback { | ||
(error: any, accessToken: string): void; | ||
(error: any, accessToken: string | null): void; | ||
} | ||
@@ -21,0 +21,0 @@ /** |
@@ -12,3 +12,3 @@ "use strict"; | ||
*/ | ||
exports.PACKAGE_VERSION = "1.2.0"; | ||
exports.PACKAGE_VERSION = "1.4.0"; | ||
/** | ||
@@ -15,0 +15,0 @@ * @extends |
@@ -28,2 +28,3 @@ import { Promise } from 'es6-promise'; | ||
orderby(properties: string | string[]): GraphRequest; | ||
search(searchStr: string): GraphRequest; | ||
filter(filterStr: string): GraphRequest; | ||
@@ -92,3 +93,4 @@ top(n: number): GraphRequest; | ||
private createQueryString; | ||
private parseDocumentResponse; | ||
private convertResponseType; | ||
} |
@@ -136,2 +136,6 @@ "use strict"; | ||
}; | ||
GraphRequest.prototype.search = function (searchStr) { | ||
this.urlComponents.oDataQueryParams["$search"] = "\"" + searchStr + "\""; | ||
return this; | ||
}; | ||
GraphRequest.prototype.filter = function (filterStr) { | ||
@@ -375,8 +379,26 @@ this.urlComponents.oDataQueryParams["$filter"] = filterStr; | ||
}; | ||
GraphRequest.prototype.parseDocumentResponse = function (response, type) { | ||
if (typeof DOMParser !== "undefined") { | ||
return new es6_promise_1.Promise(function (resolve, reject) { | ||
response.text().then(function (xmlString) { | ||
try { | ||
var parser = new DOMParser(), xmlDoc = parser.parseFromString(xmlString, type); | ||
resolve(xmlDoc); | ||
} | ||
catch (error) { | ||
reject(error); | ||
} | ||
}); | ||
}); | ||
} | ||
else { | ||
return es6_promise_1.Promise.resolve(response.body); | ||
} | ||
}; | ||
GraphRequest.prototype.convertResponseType = function (response) { | ||
var responseValue; | ||
if (!this._responseType) { | ||
this._responseType = ''; | ||
var self = this, responseValue; | ||
if (!self._responseType) { | ||
self._responseType = ''; | ||
} | ||
switch (this._responseType.toLowerCase()) { | ||
switch (self._responseType.toLowerCase()) { | ||
case ResponseType_1.ResponseType.ARRAYBUFFER: | ||
@@ -389,4 +411,3 @@ responseValue = response.arrayBuffer(); | ||
case ResponseType_1.ResponseType.DOCUMENT: | ||
// XMLHTTPRequest only :( | ||
responseValue = response.json(); | ||
responseValue = self.parseDocumentResponse(response, "text/xml"); | ||
break; | ||
@@ -403,3 +424,26 @@ case ResponseType_1.ResponseType.JSON: | ||
default: | ||
responseValue = response.json(); | ||
var contentType = response.headers.get("Content-type"); | ||
if (contentType !== null) { | ||
var mimeType = contentType.split(";")[0], documentContentTypes = ["text/html", "text/xml", "application/xml", "application/xhtml+xml"]; | ||
if (documentContentTypes.includes(mimeType)) { | ||
responseValue = self.parseDocumentResponse(response, mimeType); | ||
} | ||
else { | ||
responseValue = response.json(); | ||
} | ||
} | ||
else { | ||
/** | ||
* RFC specification {@link https://tools.ietf.org/html/rfc7231#section-3.1.1.5} says: | ||
* A sender that generates a message containing a payload body SHOULD | ||
* generate a Content-Type header field in that message unless the | ||
* intended media type of the enclosed representation is unknown to the | ||
* sender. If a Content-Type header field is not present, the recipient | ||
* MAY either assume a media type of "application/octet-stream" | ||
* ([RFC2046], Section 4.5.1) or examine the data to determine its type. | ||
* | ||
* So assuming it as a stream type so returning the body. | ||
*/ | ||
responseValue = es6_promise_1.Promise.resolve(response.body); | ||
} | ||
break; | ||
@@ -406,0 +450,0 @@ } |
@@ -10,6 +10,7 @@ import { Options } from "./common"; | ||
export * from "./common"; | ||
export * from "./ResponseType"; | ||
export * from "./ResponseHandler"; | ||
export * from "./tasks/OneDriveLargeFileUploadTask"; | ||
export * from "./ResponseType"; | ||
export * from "./tasks/PageIterator"; | ||
export * from "./content/BatchRequestContent"; | ||
export * from "./content/BatchResponseContent"; |
@@ -35,7 +35,8 @@ "use strict"; | ||
__export(require("./common")); | ||
__export(require("./ResponseType")); | ||
__export(require("./ResponseHandler")); | ||
__export(require("./tasks/OneDriveLargeFileUploadTask")); | ||
__export(require("./ResponseType")); | ||
__export(require("./tasks/PageIterator")); | ||
__export(require("./content/BatchRequestContent")); | ||
__export(require("./content/BatchResponseContent")); | ||
//# sourceMappingURL=index.js.map |
{ | ||
"name": "@microsoft/microsoft-graph-client", | ||
"//": "NOTE: The version here should match exactly the exported const PACKAGE_VERSION in common.ts. If you change it here, also change it there.", | ||
"version": "1.3.0", | ||
"version": "1.4.0", | ||
"description": "Microsoft Graph Client Library", | ||
@@ -6,0 +6,0 @@ "main": "lib/src/index.js", |
@@ -225,2 +225,13 @@ # Microsoft Graph JavaScript Client Library | ||
### $search | ||
Pass a search query string to `.search()` for searching in collections. Calling search multiple times will override previous search query. Refer graph [documentation](https://developer.microsoft.com/en-us/graph/docs/concepts/query_parameters#search-parameter) for more. | ||
```js | ||
client | ||
.api("/me/messages") | ||
.search("from:admin") | ||
.get((err, res) => { | ||
console.log(res); | ||
}); | ||
``` | ||
## Other API methods | ||
@@ -275,4 +286,4 @@ | ||
## Usage Resources | ||
1. [Large File Upload Task](/docs/tasks/LargeFileUploadTask.md) | ||
2. [Batching](/docs/content/Batching.md) | ||
* [Large File Upload Task](/docs/tasks/LargeFileUploadTask.md) | ||
* [Batching](/docs/content/Batching.md) | ||
@@ -279,0 +290,0 @@ ## Running node samples |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
383623
57
2914
375
8