Skip to content

Commit

Permalink
Merge pull request #532 from microsoftgraph/release/version-3.0.1
Browse files Browse the repository at this point in the history
Release 3.0.1
  • Loading branch information
nikithauc authored Nov 15, 2021
2 parents a3ee95d + 9a8444c commit 5cf1dec
Show file tree
Hide file tree
Showing 34 changed files with 1,332 additions and 1,270 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ src/**/*.js.map
src/**/*.d.ts

samples/**/secrets.ts
samples/**/secrets.js
samples/node_modules/**
samples/lib/

Expand Down
4 changes: 2 additions & 2 deletions design/publishing.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

##### Current set up -

1. TypeScript Source Code
1. TypeScript Source Code
/ \
Transpiles into JavaScript
'lib' folder
Expand All @@ -40,7 +40,7 @@
1. `src/browser/index.js` does not export `RedirectHandler` and `RedirectHandlerOptions`. Redirection is handled by the browser.
2. `src/browser/index.js` exports `src/browser/ImplicitMsalProvider`.
3. `src/browser/ImplicitMsalProvider` does not import or require 'msal' dependency. While, `src/ImplicitMsalProvider` imports or requires 'msal' in the implementation.
4. My assumtion is that `src/browser/ImplicitMsalProvider` is implemented specifically for the rollup process and to skip the rollup external dependency while using `graph-js-sdk.js` in the browser.
4. My assumption is that `src/browser/ImplicitMsalProvider` is implemented specifically for the rollup process and to skip the rollup external dependency while using `graph-js-sdk.js` in the browser.

Note - Browser applications using the ES modules from the npm package of the JS SDK refer to the `module` entry point - `lib/es/src/index.js`(not the browser entry point). Example - Graph Explorer.

Expand Down
2 changes: 1 addition & 1 deletion docs/ChaosHandlerSamples.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

**A request Passes through to the Graph, if there is no entry for the request**

**Note - Always add ChaosHandler before HttpMessageHandler in the midllewareChain**
**Note - Always add ChaosHandler before HttpMessageHandler in the middlewareChain**

### Samples

Expand Down
2 changes: 1 addition & 1 deletion docs/CustomMiddlewareChain.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ export class MyHttpMessageHandler implements Middleware {

### Create Middleware Chain

Can use own middlewares and the ones shipped with the library [[Here](../src/middleware) are the set of Middlwares shipped with the library] to create the middleware chain. Create a chain out of these one has to link them in sequentially manner in own preferred order using `.setNext()` method.
Can use own middlewares and the ones shipped with the library [[Here](../src/middleware) are the set of Middlewares shipped with the library] to create the middleware chain. Create a chain out of these one has to link them in sequentially manner in own preferred order using `.setNext()` method.

Using AuthenticationHandler [one shipped with the library] and MyLoggingHandler, and MyHttpMessageHandler [custom ones] to create a middleware chain here.

Expand Down
12 changes: 6 additions & 6 deletions docs/tasks/LargeFileUploadTask.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ export interface FileObject<T> {
}
```

The Microsoft Graph JavaScript Client SDK provides two implementions -
The Microsoft Graph JavaScript Client SDK provides two implementations -

1. StreamUpload - Supports Node.js stream upload

Expand All @@ -87,8 +87,8 @@ import * as fs from "fs";
const fileName = "<FILE_NAME>";
const stats = fs.statSync(`./test/sample_files/${fileName}`);
const totalsize = stats.size;
const readStream = fs.readFileSync(`./test/sample_files/${fileName}`);
const fileObject = new FileUpload(readStream, fileName, totalsize);
const fileContent = fs.readFileSync(`./test/sample_files/${fileName}`);
const fileObject = new FileUpload(fileContent, fileName, totalsize);
```

**_Note_** - You can also have a customized `FileObject` implementation which contains the `sliceFile(range: Range)` function which implements the logic to split the file into ranges.
Expand All @@ -114,7 +114,7 @@ const options: LargeFileUploadTaskOptions = {
**Create a LargefileUploadTask object**

```typescript
const uploadTask = new LargeFileUploadTask(client, fileObj, uploadSession, optionsWithProgress);
const uploadTask = new LargeFileUploadTask(client, fileObject, uploadSession, optionsWithProgress);
const uploadResult: UploadResult = await uploadTask.upload();
```

Expand All @@ -141,8 +141,8 @@ const options: OneDriveLargeFileUploadOptions = {
const readStream = fs.createReadStream(`./fileName`);
const fileObject = new StreamUpload(readStream, fileName, totalsize);
or
const readFile = fs.readFileSync(`./fileName`);
const fileObject = new FileUpload(readStream, fileName, totalsize);
const uploadContent = fs.readFileSync(`./fileName`);
const fileObject = new FileUpload(uploadContent, fileName, totalsize);

const uploadTask = await OneDriveLargeFileUploadTask.createTaskWithFileObject(client, fileObject, options);
const uploadResult:UploadResult = await uploadTask.upload();
Expand Down
6 changes: 3 additions & 3 deletions docs/tasks/PageIterator.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ async function callingPattern() {
// Creating a new page iterator instance with client a graph client instance, page collection response from request and callback
let pageIterator = new PageIterator(client, response, callback);
// This iterates the collection until the nextLink is drained out.
pageIterator.iterate();
await pageIterator.iterate();
} catch (e) {
throw e;
}
Expand All @@ -44,12 +44,12 @@ async function customSize() {
};
let pageIterator = new PageIterator(client, response, callback);
// This stops iterating over for 1000 entities.
pageIterator.iterate();
await pageIterator.iterate();

// Resuming will do start from where it left off and iterate for next 1000 entities.
// Check and resume is likely to be called in any user interaction requiring to load more data.
if (!pageIterator.isComplete()) {
pageIterator.resume();
await pageIterator.resume();
}
} catch (e) {
throw e;
Expand Down
24 changes: 16 additions & 8 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@microsoft/microsoft-graph-client",
"version": "3.0.0",
"version": "3.0.1",
"description": "Microsoft Graph Client Library",
"keywords": [
"Microsoft",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@

4. Navigate to the samples folder [./samples]and run `npm install`

5. Navigate to tokenCredentialAuthenticationProvider[./samples/javascript/clientInitialization/tokenCredentialAuthenticationProvider] in the samples directory.
5. Navigate to secrets.js[./secrets] and populate all the values (tenantId, clientId, clientSecret, scopes)

6. For running this javascript sample, run `node index.js`
6. Navigate to tokenCredentialAuthenticationProvider[./samples/javascript/clientInitialization/tokenCredentialAuthenticationProvider] in the samples directory.

7. For running this javascript sample, run `node index.js`
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,6 @@ const { clientId, clientSecret, scopes, tenantId } = require("./secrets");
require("isomorphic-fetch");

const port = "<PORT_NUMBER>";
const tenantId = "<TENANT_ID>";
const clientId = "<CLIENT_ID>";
const clientSecret = "<CLIENT_SECRET>";
const scopes = "<SCOPE>";
const redirectUri = `http://localhost:${port}/authresponse`;
const authorityHost = "https://login.microsoftonline.com";

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
const tenantId = "<TENANT_ID>";
const clientId = "<CLIENT_ID>";
const clientSecret = "<CLIENT_SECRET>";
const scopes = "<SCOPE>";

module.exports = {
tenantId: tenantId,
clientId: clientId,
clientSecret: clientSecret,
scopes: scopes
}
16 changes: 8 additions & 8 deletions samples/javascript/tasks/LargeFileUploadTask.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ async function upload() {
const file = fs.createReadStream(`./${fileName}`);

const stats = fs.statSync(`./${fileName}`);
const totalsize = stats.size;
const totalSize = stats.size;

const progress = (range, extraCallbackParam) => {
// Implement the progress callback here
Expand All @@ -31,7 +31,7 @@ async function upload() {

const uploadEventHandlers = {
progress,
extraCallbackParam: "Any paramater needed by the callback implementation",
extraCallbackParam: "Any parameter needed by the callback implementation",
};

const options = {
Expand All @@ -55,18 +55,18 @@ async function upload() {
// AttachmentItem: {
// attachmentType: 'file',
// name: "FILE_NAME",
// size: totalsize,
// size: totalSize,
// }
// }

const fileObject = new StreamUpload(file, fileName, totalsize);
const fileObject = new StreamUpload(file, fileName, totalSize);

//OR
// OR
// You can also use a FileUpload instance
//const file = fs.readFileSync();
//const fileObject = new FileUpload(file, fileName, totalsize);
// const file = fs.readFileSync();
// const fileObject = new FileUpload(file, fileName, totalSize);

//OR
// OR
// You can also create an object from a custom implementation of the FileObject interface
const task = new MicrosoftGraph.LargeFileUploadTask(client, fileObject, uploadSession, options);
const uploadResult = await task.upload();
Expand Down
2 changes: 1 addition & 1 deletion samples/javascript/tasks/OneDriveLargeFileUploadTask.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ async function upload() {

const uploadEventHandlers = {
progress,
extraCallbackParam: "any paramater needed by the callback implementation",
extraCallbackParam: "any parameter needed by the callback implementation",
};

const options = {
Expand Down
Loading

0 comments on commit 5cf1dec

Please sign in to comment.