@microsoft/microsoft-graph-client
Advanced tools
Comparing version 1.1.0 to 1.2.0
export declare let oDataQueryNames: string[]; | ||
export declare const DEFAULT_VERSION = "v1.0"; | ||
export declare const GRAPH_BASE_URL = "https://graph.microsoft.com/"; | ||
export declare const PACKAGE_VERSION = "1.0.0"; | ||
export declare const PACKAGE_VERSION = "1.2.0"; | ||
export interface AuthProviderCallback { | ||
@@ -6,0 +6,0 @@ (error: any, accessToken: string): void; |
@@ -6,4 +6,4 @@ "use strict"; | ||
exports.GRAPH_BASE_URL = "https://graph.microsoft.com/"; | ||
exports.PACKAGE_VERSION = "1.0.0"; | ||
exports.PACKAGE_VERSION = "1.2.0"; | ||
exports.oDataQueryNames = exports.oDataQueryNames.concat(exports.oDataQueryNames.map(function (s) { return "$" + s; })); | ||
//# sourceMappingURL=common.js.map |
@@ -8,2 +8,3 @@ "use strict"; | ||
var RequestMethod_1 = require("./RequestMethod"); | ||
var ResponseType_1 = require("./ResponseType"); | ||
var GraphHelper_1 = require("./GraphHelper"); | ||
@@ -232,3 +233,3 @@ var GraphRequest = (function () { | ||
}; | ||
self.responseType("stream"); | ||
self.responseType(ResponseType_1.ResponseType.STREAM); | ||
Object.keys(self._headers).forEach(function (key) { return options_1.headers[key] = self._headers[key]; }); | ||
@@ -310,20 +311,20 @@ self.handleFetch(url, callback, options_1); | ||
switch (this._responseType.toLowerCase()) { | ||
case "arraybuffer": | ||
case ResponseType_1.ResponseType.ARRAYBUFFER: | ||
responseValue = response.arrayBuffer(); | ||
break; | ||
case "blob": | ||
case ResponseType_1.ResponseType.BLOB: | ||
responseValue = response.blob(); | ||
break; | ||
case "document": | ||
case ResponseType_1.ResponseType.DOCUMENT: | ||
responseValue = response.json(); | ||
break; | ||
case "json": | ||
case ResponseType_1.ResponseType.JSON: | ||
responseValue = response.json(); | ||
break; | ||
case "text": | ||
case ResponseType_1.ResponseType.STREAM: | ||
responseValue = es6_promise_1.Promise.resolve(response.body); | ||
break; | ||
case ResponseType_1.ResponseType.TEXT: | ||
responseValue = response.text(); | ||
break; | ||
case "stream": | ||
responseValue = es6_promise_1.Promise.resolve(response.body); | ||
break; | ||
default: | ||
@@ -330,0 +331,0 @@ responseValue = response.json(); |
@@ -11,1 +11,2 @@ import { Options } from "./common"; | ||
export * from "./ResponseHandler"; | ||
export * from "./ResponseType"; |
@@ -32,2 +32,3 @@ "use strict"; | ||
__export(require("./ResponseHandler")); | ||
__export(require("./ResponseType")); | ||
//# sourceMappingURL=index.js.map |
@@ -48,4 +48,4 @@ "use strict"; | ||
message: errObj.message, | ||
requestId: errObj.innerError["request-id"], | ||
date: new Date(errObj.innerError.date), | ||
requestId: (errObj.innerError !== undefined) ? errObj.innerError["request-id"] : "", | ||
date: (errObj.innerError !== undefined) ? new Date(errObj.innerError.date) : new Date(), | ||
body: errObj | ||
@@ -52,0 +52,0 @@ }; |
{ | ||
"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.1.0", | ||
"version": "1.2.0", | ||
"description": "Microsoft Graph Client Library", | ||
@@ -21,3 +21,8 @@ "main": "lib/src/index.js", | ||
"scripts": { | ||
"build": "tsc && node node-browserify.js > lib/graph-js-sdk-web.js && uglifyjs ./lib/graph-js-sdk-web.js --output ./lib/graph-js-sdk-web.js", | ||
"compile": "tsc", | ||
"rollup-core": "node core-browserify.js > lib/graph-js-sdk-core.js && uglifyjs lib/graph-js-sdk-core.js --output lib/graph-js-sdk-core.js", | ||
"rollup-with-vendor": "node node-browserify.js > lib/graph-js-sdk-web.js && uglifyjs ./lib/graph-js-sdk-web.js --output ./lib/graph-js-sdk-web.js", | ||
"build-core": "npm run compile && npm run rollup-core", | ||
"build-with-vendor": "npm run compile && npm run rollup-with-vendor", | ||
"build": "npm run compile && npm run rollup-core && npm run rollup-with-vendor", | ||
"test": "mocha lib/spec/core", | ||
@@ -24,0 +29,0 @@ "test:types": "tsc --p spec/types && mocha spec/types" |
@@ -21,4 +21,11 @@ # Microsoft Graph JavaScript Client Library | ||
Include [lib/graph-js-sdk-web.js](https://github.com/microsoftgraph/msgraph-sdk-javascript/raw/master/lib/graph-js-sdk-web.js) in your page. | ||
The library comes with two varieties of options, you can pick one based on your use case | ||
1. If your application has polyfills for **Fetch-API** and **ES6-Promise**, then can just include [lib/graph-js-sdk-core.js](./lib/graph-js-sdk-core.js) in your page. | ||
```html | ||
<script type="text/javascript" src="graph-js-sdk-core.js"></script> | ||
``` | ||
2. If your application does not have polyfills for **Fetch-API** and **ES6-Promise**, then you have to include [lib/graph-js-sdk-web.js](./lib/graph-js-sdk-web.js) in your page. | ||
```html | ||
<script type="text/javascript" src="graph-js-sdk-web.js"></script> | ||
@@ -245,3 +252,15 @@ ``` | ||
### .responseType() | ||
To set a custom response type, use the `.responseType(string)` method. To see an example, check the [browser sample](samples/browser/index.html) that downloads an image and displays it in an `<img>` element. | ||
To set a custom response type, use the `.responseType(<ResponseType>)` method. Refer [ResponseType.ts](./src/ResponseType.ts) for available options. | ||
````js | ||
client | ||
.api(`/me/drive/root/children/${fileName}/content`) | ||
.responseType(MicrosoftGraph.ResponseType.BLOB) | ||
.get() | ||
.then((res) => { | ||
console.log("Downloaded..!!"); | ||
}) | ||
.catch((err) => { | ||
throw err; | ||
}); | ||
```` | ||
@@ -318,26 +337,4 @@ ## Running node samples | ||
Please see the [contributing guidelines](CONTRIBUTING.md). | ||
## Changelog | ||
#### 1.0.0 | ||
* Added tests for new Graph functionality - Delta query, Extensibility, OneNote, and more. | ||
#### 0.4.0 | ||
* Add support for ES5. Make sure to use `graph-js-sdk-web.js` for web apps | ||
* Removed iterator helper method. | ||
#### 0.3.1 | ||
* Support for Node.js versions 4 and 5 | ||
#### 0.3.0 | ||
* Migrated away from typings in client library core and TypeScript sample | ||
#### 0.2.2 | ||
* Updated SuperAgent to version ``` 3.3.0 ``` | ||
#### 0.2.0 | ||
* **Breaking change for existing apps** - Initialize the client library with `MicrosoftGraph.Client.init({...})`. See the updated usage section below for code samples. | ||
* Added response handling tests to simulate Graph calls | ||
* Added type declarations file for core client library, which adds intellisense for chained methods. | ||
## Additional resources | ||
@@ -344,0 +341,0 @@ |
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
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
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
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
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
200776
404547
36
785
3
352
5