Skip to content

Commit ffc0cf5

Browse files
author
lahuey
authored
Merge branch 'fetchApiUpdate' into lahuey/RemoveSuperAgentDependency
2 parents e5d9d97 + 9a086ac commit ffc0cf5

File tree

15 files changed

+99
-11
lines changed

15 files changed

+99
-11
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
.vscode/
1+
/.vscode/*
2+
!/.vscode/launch.json
23
.DS_Store
34
.tmp
45
tmp

.vscode/launch.json

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
{
2+
// Use IntelliSense to learn about possible attributes.
3+
// Hover to view descriptions of existing attributes.
4+
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
5+
"version": "0.2.0",
6+
"configurations": [
7+
{
8+
"type": "node",
9+
"request": "launch",
10+
"name": "Run node samples",
11+
"program": "${workspaceRoot}/samples/node/node-sample.js",
12+
"cwd": "${workspaceRoot}",
13+
"outFiles": [],
14+
"internalConsoleOptions": "openOnSessionStart"
15+
},
16+
{
17+
"type": "node",
18+
"request": "launch",
19+
"name": "Run core tests",
20+
"program": "${workspaceRoot}/node_modules/mocha/bin/_mocha",
21+
"args": [
22+
"${workspaceRoot}/lib/spec/core/*.js"
23+
],
24+
"cwd": "${workspaceRoot}",
25+
"outFiles": [],
26+
"internalConsoleOptions": "openOnSessionStart"
27+
}
28+
]
29+
}

README.md

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -243,6 +243,16 @@ You can pass in additional request headers, either individually or in a dictiona
243243
### .responseType()
244244
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.
245245

246+
## Running node samples
247+
You can run and debug the node samples found under [./samples/node/node-sample.js](./samples/node/node-sample.js) by running the *Run node samples* configuration from the **Debug** (Ctrl + Shift + D) menu in Visual Studio Code. Alternately, you can run the node samples from the CLI by entering `node ./samples/node/node-sample.js` (assuming you are at the root of this repo). You'll need to rename the *secrets.example.json* file to *secrets.json* and add a valid access token to it. You can get an access token by doing the following:
248+
1. Go to [Graph Explorer](https://developer.microsoft.com/en-us/graph/graph-explorer).
249+
2. Login with the account you want to use to run the node samples.
250+
3. Open the F12 dev tools.
251+
4. Type `tokenPlease()` into the console to get an access token.
252+
5. Copy the access token and put it into the *secrets.json* file and save the file.
253+
254+
We suggest that you become acquainted with these samples as they show some of the main use scenarios for this client library.
255+
246256
## Additional information
247257
### Options in `MicrosoftGraph.Client.init()`
248258

@@ -287,7 +297,7 @@ These steps are not required to use this library.
287297

288298
```npm pack``` bundles the npm module.
289299

290-
```npm test``` runs tests of the core library (URL parsing, mock responses, etc)
300+
```npm test``` runs tests of the core library (URL parsing, mock responses, etc). You can also set breakpoints and run this from within Visual Studio Code by selecting the *Run core test* configuration from the Debug view.
291301

292302
```npm run test:types``` to run tests against the Graph API for users, groups, Excel, OneNote, etc.
293303

@@ -339,3 +349,6 @@ Please see the [contributing guidelines](CONTRIBUTING.md).
339349
Copyright (c) Microsoft Corporation. All rights reserved.
340350

341351
This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments.
352+
353+
## Third Party Notices
354+
See [Third Party Notices](https://github.com/microsoftgraph/msgraph-sdk-javascript/blob/master/THIRD%20PARTY%20NOTICES) for information on the packages that are included in the [package.json](https://github.com/microsoftgraph/msgraph-sdk-javascript/blob/master/package.json)

THIRD PARTY NOTICES

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
This file is based on or incorporates material from the projects listed below (Third Party OSS). The original copyright notice and the license under which Microsoft received such Third Party OSS, are set forth below. Such licenses and notices are provided for informational purposes only. Microsoft licenses the Third Party OSS to you under the licensing terms for the Microsoft product or service. Microsoft
2+
reserves all other rights not expressly granted under this agreement, whether by implication, estoppel or otherwise.
3+
4+
superagent - 3.5.2
5+
6+
es6-promise - 4.1.0
7+
8+
Provided for Informational Purposes Only
9+
10+
MIT License
11+
12+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the Software), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
13+
14+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
15+
16+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

lib/graph-js-sdk-web.js

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ var common_1 = require("./common");
1111
var ResponseHandler_1 = require("./ResponseHandler");
1212
var RequestMethod_1 = require("./RequestMethod");
1313
var packageInfo = require('../../package.json');
14+
1415
var GraphRequest = (function () {
1516
function GraphRequest(config, path) {
1617
this.config = config;
@@ -254,7 +255,7 @@ var GraphRequest = (function () {
254255
GraphRequest.prototype.configureRequest = function (request, accessToken) {
255256
var _this = this;
256257
request.headers.append('Authorization', 'Bearer ' + accessToken);
257-
request.headers.append('SdkVersion', "graph-js-" + packageInfo.version);
258+
request.headers.append('SdkVersion', "graph-js-" + common_1.PACKAGE_VERSION);
258259
Object.keys(this._headers).forEach(function (key) { return request.headers.set(key, _this._headers[key]); });
259260
return request;
260261
};
@@ -333,6 +334,7 @@ var RequestMethod;
333334
})(RequestMethod = exports.RequestMethod || (exports.RequestMethod = {}));
334335

335336
},{}],4:[function(require,module,exports){
337+
336338
"use strict";
337339
Object.defineProperty(exports, "__esModule", { value: true });
338340
var ResponseHandler = (function () {
@@ -395,10 +397,14 @@ Object.defineProperty(exports, "__esModule", { value: true });
395397
exports.oDataQueryNames = ["select", "expand", "orderby", "filter", "top", "skip", "skipToken", "count"];
396398
exports.DEFAULT_VERSION = "v1.0";
397399
exports.GRAPH_BASE_URL = "https://graph.microsoft.com/";
400+
exports.PACKAGE_VERSION = "1.0.0";
398401
exports.oDataQueryNames = exports.oDataQueryNames.concat(exports.oDataQueryNames.map(function (s) { return "$" + s; }));
399402

400403
},{}],6:[function(require,module,exports){
401404
"use strict";
405+
function __export(m) {
406+
for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
407+
}
402408
Object.defineProperty(exports, "__esModule", { value: true });
403409
var common_1 = require("./common");
404410
var GraphRequest_1 = require("./GraphRequest");
@@ -423,7 +429,9 @@ var Client = (function () {
423429
return Client;
424430
}());
425431
exports.Client = Client;
426-
432+
__export(require("./GraphRequest"));
433+
__export(require("./common"));
434+
__export(require("./ResponseHandler"));
427435
},{"./GraphRequest":2,"./common":5}],7:[function(require,module,exports){
428436
(function (process,global){
429437
/*!
@@ -1783,6 +1791,7 @@ process.umask = function() { return 0; };
17831791
(function(self) {
17841792
'use strict';
17851793

1794+
17861795
if (self.fetch) {
17871796
return
17881797
}
@@ -1927,6 +1936,7 @@ process.umask = function() { return 0; };
19271936
return iteratorFor(items)
19281937
}
19291938

1939+
19301940
if (support.iterable) {
19311941
Headers.prototype[Symbol.iterator] = Headers.prototype.entries
19321942
}
@@ -2274,5 +2284,4 @@ module.exports={
22742284
"url": "https://github.com/microsoftgraph/msgraph-sdk-javascript.git"
22752285
}
22762286
}
2277-
22782287
},{}]},{},[1]);

lib/src/GraphRequest.js

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

lib/src/common.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
export declare let oDataQueryNames: string[];
22
export declare const DEFAULT_VERSION = "v1.0";
33
export declare const GRAPH_BASE_URL = "https://graph.microsoft.com/";
4+
export declare const PACKAGE_VERSION = "1.0.0";
45
export interface AuthProviderCallback {
56
(error: any, accessToken: string): void;
67
}

lib/src/common.js

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

lib/src/common.js.map

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

lib/src/index.d.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,6 @@ export declare class Client {
55
static init(clientOptions?: Options): Client;
66
api(path: string): GraphRequest;
77
}
8+
export * from "./GraphRequest";
9+
export * from "./common";
10+
export * from "./ResponseHandler";

0 commit comments

Comments
 (0)