diff --git a/design/publishing.md b/design/publishing.md index a248e811e..b5e0475ca 100644 --- a/design/publishing.md +++ b/design/publishing.md @@ -20,7 +20,7 @@ ##### Current set up - -1. TypeScript Source Code +1. TypeScript Source Code / \ Transpiles into JavaScript 'lib' folder @@ -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. diff --git a/docs/ChaosHandlerSamples.md b/docs/ChaosHandlerSamples.md index d87544c26..19c0d5b36 100644 --- a/docs/ChaosHandlerSamples.md +++ b/docs/ChaosHandlerSamples.md @@ -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 diff --git a/docs/CustomMiddlewareChain.md b/docs/CustomMiddlewareChain.md index d86163088..a51356204 100644 --- a/docs/CustomMiddlewareChain.md +++ b/docs/CustomMiddlewareChain.md @@ -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. diff --git a/docs/tasks/LargeFileUploadTask.md b/docs/tasks/LargeFileUploadTask.md index b483e3d27..8bd08cec3 100644 --- a/docs/tasks/LargeFileUploadTask.md +++ b/docs/tasks/LargeFileUploadTask.md @@ -61,7 +61,7 @@ export interface FileObject { } ``` -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 diff --git a/samples/javascript/tasks/LargeFileUploadTask.js b/samples/javascript/tasks/LargeFileUploadTask.js index 03db57801..2e1b0b1c2 100644 --- a/samples/javascript/tasks/LargeFileUploadTask.js +++ b/samples/javascript/tasks/LargeFileUploadTask.js @@ -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 @@ -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 = { @@ -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(); diff --git a/samples/javascript/tasks/OneDriveLargeFileUploadTask.js b/samples/javascript/tasks/OneDriveLargeFileUploadTask.js index 212a03c05..41e533c70 100644 --- a/samples/javascript/tasks/OneDriveLargeFileUploadTask.js +++ b/samples/javascript/tasks/OneDriveLargeFileUploadTask.js @@ -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 = { diff --git a/samples/typescript/tasks/LargeFileUploadTask.ts b/samples/typescript/tasks/LargeFileUploadTask.ts index 25432eac0..68d0c62bb 100644 --- a/samples/typescript/tasks/LargeFileUploadTask.ts +++ b/samples/typescript/tasks/LargeFileUploadTask.ts @@ -9,6 +9,8 @@ // First, create an instance of the Microsoft Graph JS SDK Client class +import { LargeFileUploadSession, LargeFileUploadTask, LargeFileUploadTaskOptions, Range, StreamUpload, UploadEventHandlers, UploadResult } from "@microsoft/microsoft-graph-client"; +import * as fs from "fs"; import { client } from "../clientInitialization/ClientWithOptions"; /** * OR @@ -16,14 +18,12 @@ import { client } from "../clientInitialization/ClientWithOptions"; * OR * require or import client created using an custom authentication provider */ -import * as fs from "fs"; -import { LargeFileUploadTaskOptions, LargeFileUploadSession, LargeFileUploadTask, StreamUpload, UploadEventHandlers, UploadResult, Range, FileUpload } from "@microsoft/microsoft-graph-client"; async function upload(): Promise { const file = fs.createReadStream("./test.pdf"); const stats = fs.statSync(`./test.pdf`); - const totalsize = stats.size; + const totalSize = stats.size; const progress = (range?: Range, extraCallbackParam?: unknown) => { // Implement the progress callback here @@ -34,7 +34,7 @@ async function upload(): Promise { const uploadEventHandlers: UploadEventHandlers = { progress, - extraCallbackParam: "any paramater needed by the callback implementation", + extraCallbackParam: "any parameter needed by the callback implementation", }; const options: LargeFileUploadTaskOptions = { @@ -58,18 +58,18 @@ async function upload(): Promise { // AttachmentItem: { // attachmentType: 'file', // name: "FILE_NAME", - // size: totalsize, + // size: totalSize, // } // } - const fileObject = new StreamUpload(file, "test.pdf", totalsize); + const fileObject = new StreamUpload(file, "test.pdf", totalSize); - //OR + // OR // You can also use a FileUpload instance - //const file = fs.readFileSync(); - //const fileObject = new FileUpload(file, 'test.pdf', totalsize); + // const file = fs.readFileSync(); + // const fileObject = new FileUpload(file, 'test.pdf', totalSize); - //OR + // OR // You can also create an object from a custom implementation of FileObject const task = new LargeFileUploadTask(client, fileObject, uploadSession, options); const uploadResult = await task.upload(); diff --git a/samples/typescript/tasks/OneDriveLargeFileUploadTask.ts b/samples/typescript/tasks/OneDriveLargeFileUploadTask.ts index a50f61611..4dd1c5ee9 100644 --- a/samples/typescript/tasks/OneDriveLargeFileUploadTask.ts +++ b/samples/typescript/tasks/OneDriveLargeFileUploadTask.ts @@ -8,6 +8,9 @@ // First, create an instance of the Microsoft Graph JS SDK Client class /* eslint-disable simple-import-sort/imports*/ +import { OneDriveLargeFileUploadOptions, OneDriveLargeFileUploadTask, Range, StreamUpload, UploadEventHandlers, UploadResult } from "@microsoft/microsoft-graph-client"; +import * as fs from "fs"; +import { Readable } from "stream"; import { client } from "../clientInitialization/ClientWithOptions"; /** * OR @@ -15,15 +18,12 @@ import { client } from "../clientInitialization/ClientWithOptions"; * OR * require or import client created using an custom authentication provider */ -import { OneDriveLargeFileUploadOptions, OneDriveLargeFileUploadTask, Range, StreamUpload, UploadEventHandlers, UploadResult } from "@microsoft/microsoft-graph-client"; -import * as fs from "fs"; -import { Readable } from "stream"; async function upload() { const file = fs.createReadStream("./test.pdf"); const fileName = "FILENAME"; const stats = fs.statSync(`./test.pdf`); - const totalsize = stats.size; + const totalSize = stats.size; const progress = (range?: Range, extraCallBackParam?: unknown) => { console.log("uploading range: ", range); @@ -33,7 +33,7 @@ async function upload() { const uploadEventHandlers: UploadEventHandlers = { progress, - extraCallbackParam: "any paramater needed by the callback implementation", + extraCallbackParam: "any parameter needed by the callback implementation", }; const options: OneDriveLargeFileUploadOptions = { @@ -43,7 +43,7 @@ async function upload() { uploadEventHandlers, }; - const stream = new StreamUpload(file, "test.pdf", totalsize); + const stream = new StreamUpload(file, "test.pdf", totalSize); const task = await OneDriveLargeFileUploadTask.createTaskWithFileObject(client, stream, options); const uploadResult: UploadResult = await task.upload(); return uploadResult; diff --git a/src/GraphClientError.ts b/src/GraphClientError.ts index f6ef31a8d..9509c3836 100644 --- a/src/GraphClientError.ts +++ b/src/GraphClientError.ts @@ -33,7 +33,7 @@ export class GraphClientError extends Error { * @static * @async * To set the GraphClientError object - * @param {any} - The error returned encountered by the Graph JavaScript Client SDK while processing request + * @param {any} error - The error returned encountered by the Graph JavaScript Client SDK while processing request * @returns GraphClientError object set to the error passed */ public static setGraphClientError(error: any): GraphClientError { diff --git a/src/GraphError.ts b/src/GraphError.ts index 9193c8e3d..b846fb3f8 100644 --- a/src/GraphError.ts +++ b/src/GraphError.ts @@ -53,6 +53,8 @@ export class GraphError extends Error { * @constructor * Creates an instance of GraphError * @param {number} [statusCode = -1] - The status code of the error + * @param {string} [message] - The message of the error + * @param {Error} [baseError] - The base error * @returns An instance of GraphError */ public constructor(statusCode = -1, message?: string, baseError?: Error) { diff --git a/src/GraphRequestUtil.ts b/src/GraphRequestUtil.ts index 47fc6e17f..02cf6c156 100644 --- a/src/GraphRequestUtil.ts +++ b/src/GraphRequestUtil.ts @@ -114,7 +114,7 @@ const isValidEndpoint = (url: string, allowedHosts: Set = GRAPH_URLS): b /** * Throws error if the string is not a valid host/hostname and contains other url parts. - * @param {string} url - The host to be verified + * @param {string} host - The host to be verified */ const isCustomHostValid = (host: string) => { if (host.indexOf("/") !== -1) { diff --git a/src/HTTPClient.ts b/src/HTTPClient.ts index 71fa606ef..c740f6b03 100644 --- a/src/HTTPClient.ts +++ b/src/HTTPClient.ts @@ -57,7 +57,7 @@ export class HTTPClient { /** * @private * Processes the middleware array to construct the chain - * and sets this.middleware property to the first middlware handler of the array + * and sets this.middleware property to the first middleware handler of the array * The calling function should validate if middleware is not undefined or not empty * @param {Middleware[]} middlewareArray - The array of middleware handlers * @returns Nothing diff --git a/src/HTTPClientFactory.ts b/src/HTTPClientFactory.ts index d97fce35f..1b01b9fad 100644 --- a/src/HTTPClientFactory.ts +++ b/src/HTTPClientFactory.ts @@ -42,7 +42,7 @@ export class HTTPClientFactory { * @returns A HTTPClient instance * * NOTE: These are the things that we need to remember while doing modifications in the below default pipeline. - * * HTTPMessageHander should be the last one in the middleware pipeline, because this makes the actual network call of the request + * * HTTPMessageHandler should be the last one in the middleware pipeline, because this makes the actual network call of the request * * TelemetryHandler should be the one prior to the last middleware in the chain, because this is the one which actually collects and appends the usage flag and placing this handler * before making the actual network call ensures that the usage of all features are recorded in the flag. * * The best place for AuthenticationHandler is in the starting of the pipeline, because every other handler might have to work for multiple times for a request but the auth token for * them will remain same. For example, Retry and Redirect handlers might be working multiple times for a request based on the response but their auth token would remain same. diff --git a/src/middleware/ChaosHandler.ts b/src/middleware/ChaosHandler.ts index 637841285..8f5d6073b 100644 --- a/src/middleware/ChaosHandler.ts +++ b/src/middleware/ChaosHandler.ts @@ -86,7 +86,7 @@ export class ChaosHandler implements Middleware { /** * Generates responseBody * @private - * @param {ChaosHandlerOptions} options - The ChaosHandlerOptions object + * @param {ChaosHandlerOptions} chaosHandlerOptions - The ChaosHandlerOptions object * @param {string} requestID - request id * @param {string} requestDate - date of the request * * @returns response body @@ -119,7 +119,7 @@ export class ChaosHandler implements Middleware { /** * creates a response * @private - * @param {ChaosHandlerOptions} ChaosHandlerOptions - The ChaosHandlerOptions object + * @param {ChaosHandlerOptions} chaosHandlerOptions - The ChaosHandlerOptions object * @param {Context} context - Contains the context of the request */ private createResponse(chaosHandlerOptions: ChaosHandlerOptions, context: Context) { @@ -177,7 +177,7 @@ export class ChaosHandler implements Middleware { /** * To fetch the status code from the map(if needed), then returns response by calling createResponse * @private - * @param {ChaosHandlerOptions} ChaosHandlerOptions - The ChaosHandlerOptions object + * @param {ChaosHandlerOptions} chaosHandlerOptions - The ChaosHandlerOptions object * @param {string} requestURL - the URL for the request * @param {string} requestMethod - the API method for the request */ diff --git a/src/middleware/options/ChaosHandlerOptions.ts b/src/middleware/options/ChaosHandlerOptions.ts index 329a30876..39fcd1cff 100644 --- a/src/middleware/options/ChaosHandlerOptions.ts +++ b/src/middleware/options/ChaosHandlerOptions.ts @@ -66,7 +66,7 @@ export class ChaosHandlerOptions implements MiddlewareOptions { * @public * @constructor * To create an instance of Testing Handler Options - * @param {ChaosStrategy} ChaosStrategy - Specifies the startegy used for the Testing Handler -> RAMDOM/MANUAL + * @param {ChaosStrategy} chaosStrategy - Specifies the startegy used for the Testing Handler -> RAMDOM/MANUAL * @param {string} statusMessage - The Message to be returned in the response * @param {number?} statusCode - The statusCode to be returned in the response * @param {number?} chaosPercentage - The percentage of randomness/chaos in the handler