Skip to content

Commit 2ac83f1

Browse files
nikithaucAbrax20darrelmillerkrototypemuthu-rathinam
authored
Nikithauc/merge release 2.1.0 dev (#345)
* FIx Batching Documentation code The code example in the Batching Documentation does not work. The batchResponse is not set in the example code. * Correcting missing import, incorrect reference in example (#326) * Release - 2.1.0 (#338) * updated broken link in README * Post request with empty body, now working fine. * updated the tests for this case * made change to use undefined instead of null as classname * added functionality to simplify building middleware chain * Updated GraphRequest.ts for .count() scenario Updated GraphRequest.ts to handle .count() when no parameter is specified * Bumped version to '2.1.0-Preview.1' * Adding the Modifying middleware chain samples * - fixes broken link to client instance * Updated the example to the correct return type * fix casing on filename * Update package.json * Designed ChaosHandler * Removing the set and get middleware chain method * Update README * Update README * Bump lodash from 4.17.15 to 4.17.19 in /samples/browser Bumps [lodash](https://github.com/lodash/lodash) from 4.17.15 to 4.17.19. - [Release notes](https://github.com/lodash/lodash/releases) - [Commits](lodash/lodash@4.17.15...4.17.19) Signed-off-by: dependabot[bot] <support@github.com> * Changed parsepath and query functions to split query params on first equals sign considering nested queries. Added comments to query functions * Correcting spelling in comments, setting the param key directlyand replacing ternary condition with if else * Adding a buildheaders function to conditionally set content type and checking if body is null when serializing content * Altering condition to be optimal Co-authored-by: Mustafa Zengin <muzengin@microsoft.com> * Adding formdata to the node project, setting the esModuleInterop config as true for allowing import of npm modules, adding unit test for application/xhtml+xml content type post * Adding a private query parsing function and more validations * Adding tests for url parsing and comments to the private url parsing functions * Adding more information in the return comments for functions returning the GraphRequest instance * Adding unit test for serializecontent testing if content is null, changed content type setting for put and patch * Changing the conditional expression to check for undefined or null headers Co-authored-by: Mustafa Zengin <muzengin@microsoft.com> * Adding the missing return Co-authored-by: Mustafa Zengin <muzengin@microsoft.com> * Removing the try catch block from the test case * Removing the try catch block from the test case * Returning if the content-type is present else setting content-type as default * Uninstalling formdata, restoring the tsconfigs and removing the condition to check if form-data is undefined in GraphRequest.ts * Restoring file * Reverting the package json changes * Bump yargs-parser from 13.1.1 to 13.1.2 in /samples/browser (#321) Bumps [yargs-parser](https://github.com/yargs/yargs-parser) from 13.1.1 to 13.1.2. - [Release notes](https://github.com/yargs/yargs-parser/releases) - [Changelog](https://github.com/yargs/yargs-parser/blob/master/docs/CHANGELOG-full.md) - [Commits](https://github.com/yargs/yargs-parser/commits) Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump mixin-deep from 1.3.1 to 1.3.2 in /scripts (#301) Bumps [mixin-deep](https://github.com/jonschlinkert/mixin-deep) from 1.3.1 to 1.3.2. - [Release notes](https://github.com/jonschlinkert/mixin-deep/releases) - [Commits](jonschlinkert/mixin-deep@1.3.1...1.3.2) Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Vincent Biret <vibiret@microsoft.com> Co-authored-by: nikithauc <nikithauc@gmail.com> * Bump http-proxy from 1.17.0 to 1.18.1 in /samples/browser (#319) Bumps [http-proxy](https://github.com/http-party/node-http-proxy) from 1.17.0 to 1.18.1. - [Release notes](https://github.com/http-party/node-http-proxy/releases) - [Changelog](https://github.com/http-party/node-http-proxy/blob/master/CHANGELOG.md) - [Commits](http-party/node-http-proxy@1.17.0...1.18.1) Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Update OneDriveLargeFileUploadTask.ts (#325) * Update OneDriveLargeFileUploadTask.ts Trying to upload files with the '#' or '%' character in the filename ends with network errors of the form - 400 status response "The parameter item does not exist in method getByPath" Encoding the entire URL does not encode URL components correctly. When the SDK's client tries to encode these URL components in the parameters on the call to OneDriveLargeFileUploadTask.create, then the resultant file in OneDrive has the URL encoded filename (as opposed to the user-friendly/decoded filename). Therefore, fix the encoding in the SDK's URL components itself, directly. * Update OneDriveLargeFileUploadTask.ts Fix typo * Update src/tasks/OneDriveLargeFileUploadTask.ts Updated comment Co-authored-by: Mustafa Zengin <mzengin88@gmail.com> * Update OneDriveLargeFileUploadTask.ts Updated comment Co-authored-by: Mustafa Zengin <mzengin88@gmail.com> * Use correct class name (#284) Co-authored-by: Vincent Biret <vibiret@microsoft.com> Co-authored-by: nikithauc <nikithauc@gmail.com> * Typo in documentation example. (#270) Co-authored-by: Vincent Biret <vibiret@microsoft.com> Co-authored-by: nikithauc <nikithauc@gmail.com> * Enhancement/#311 page iterator request options (#318) * Adding request options property to PageIterator * Adding tests for page iterator task to test passing along the headers * using headersinit type for headers * Specifying parameter definition * using constants * Updating function documentation * remove response type, test passing fetchoptions * testing requestOptions set in pageiterator * typos, optional parameters comments * Sorting parameter list - chaoshandleroptions (#334) * Client init with middleware array (#333) * Passing midddleware array in client options * Tests for middleware array * Removing try catch * ifnode condition,chain middleware test * Adding missing exports * Array initialization Co-authored-by: Vincent Biret <vibiret@microsoft.com> * merging with dev * Using spread operator * Checking if middleware is not empty Co-authored-by: Vincent Biret <vibiret@microsoft.com> * Make GraphError real Error (#335) Co-authored-by: nikithauc <nikithauc@gmail.com> * Using ternary shorthand, upgrade preview 2.1.0-2 (#337) * Bump version to 2.1.0 * changing.substring parameter, comments to check middleware * adding tests, urlotherqueryoptions type Co-authored-by: Abhinav Srivastava <abhinav.0543@gmail.com> Co-authored-by: muthurathinam <mumuthus@microsoft.com> Co-authored-by: Vincent Biret <vincentbiret@hotmail.com> Co-authored-by: warreee <ward.schodts@student.kuleuven.be> Co-authored-by: Gideon Goldberg <gidsgoldberg@gmail.com> Co-authored-by: Muthurathinam <6259786+muthurathinam@users.noreply.github.com> Co-authored-by: Nikola Metulev <nmetulev@users.noreply.github.com> Co-authored-by: Behnam Mohammadi <behnam.mohammadi@snapp.cab> Co-authored-by: DeVere Dyett <ddyett@microsoft.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Mustafa Zengin <muzengin@microsoft.com> Co-authored-by: Michael Mainer <MIchaelMainer@users.noreply.github.com> Co-authored-by: Vincent Biret <vibiret@microsoft.com> Co-authored-by: Hari Sridharan <hasridha@microsoft.com> Co-authored-by: Mustafa Zengin <mzengin88@gmail.com> Co-authored-by: mattdenkers <mbdenkers@gmail.com> Co-authored-by: lewgordon <50742795+lewgordon@users.noreply.github.com> Co-authored-by: Olivier Cuypers <oliviercuyp@gmail.com> Co-authored-by: Abrax20 <abs.christoph@gmail.com> Co-authored-by: Darrel <darrmi@microsoft.com> Co-authored-by: Abhinav Srivastava <abhinav.0543@gmail.com> Co-authored-by: muthurathinam <mumuthus@microsoft.com> Co-authored-by: Vincent Biret <vincentbiret@hotmail.com> Co-authored-by: warreee <ward.schodts@student.kuleuven.be> Co-authored-by: Gideon Goldberg <gidsgoldberg@gmail.com> Co-authored-by: Muthurathinam <6259786+muthurathinam@users.noreply.github.com> Co-authored-by: Nikola Metulev <nmetulev@users.noreply.github.com> Co-authored-by: Behnam Mohammadi <behnam.mohammadi@snapp.cab> Co-authored-by: DeVere Dyett <ddyett@microsoft.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Mustafa Zengin <muzengin@microsoft.com> Co-authored-by: Michael Mainer <MIchaelMainer@users.noreply.github.com> Co-authored-by: Vincent Biret <vibiret@microsoft.com> Co-authored-by: Hari Sridharan <hasridha@microsoft.com> Co-authored-by: Mustafa Zengin <mzengin88@gmail.com> Co-authored-by: mattdenkers <mbdenkers@gmail.com> Co-authored-by: lewgordon <50742795+lewgordon@users.noreply.github.com> Co-authored-by: Olivier Cuypers <oliviercuyp@gmail.com>
1 parent 66a4181 commit 2ac83f1

File tree

9 files changed

+16
-18
lines changed

9 files changed

+16
-18
lines changed

README-Localized/README-es-es.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,6 @@ Consulte devDependencies en [package.json](./package.json) para ver la versión
6868
```
6969

7070
```typescript
71-
7271
// Configuration options for MSAL @see https://github.com/AzureAD/microsoft-authentication-library-for-js/wiki/MSAL.js-1.0.0-api-release#configuration-options
7372
const msalConfig = {
7473
auth: {

README-Localized/README-fr-fr.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,6 @@ Reportez-vous à devDependencies dans [package.json](./package.json) pour la ver
6868
```
6969

7070
```typescript
71-
7271
// Configuration options for MSAL @see https://github.com/AzureAD/microsoft-authentication-library-for-js/wiki/MSAL.js-1.0.0-api-release#configuration-options
7372
const msalConfig = {
7473
auth: {

README-Localized/README-ja-jp.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,6 @@ Microsoft Graph JavaScript クライアント ライブラリには、`accessTok
6868
```
6969

7070
```typescript
71-
7271
// Configuration options for MSAL @see https://github.com/AzureAD/microsoft-authentication-library-for-js/wiki/MSAL.js-1.0.0-api-release#configuration-options
7372
const msalConfig = {
7473
auth: {

README-Localized/README-pt-br.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,6 @@ Consulte devDependencies no [package.json](./package.json) para a versão msal c
6868
```
6969

7070
```typescript
71-
7271
// Configuration options for MSAL @see https://github.com/AzureAD/microsoft-authentication-library-for-js/wiki/MSAL.js-1.0.0-api-release#configuration-options
7372
const msalConfig = {
7473
auth: {
@@ -226,4 +225,4 @@ Copyright (c) Microsoft Corporation. Todos os direitos reservados. Licenciado so
226225

227226
## Valorizamos e cumprimos o Código de Conduta de Código Aberto da Microsoft
228227

229-
Este projeto adotou o [Código de Conduta de Código Aberto da Microsoft](https://opensource.microsoft.com/codeofconduct/). Para saber mais, confira as [Perguntas frequentes sobre o Código de Conduta](https://opensource.microsoft.com/codeofconduct/faq/) ou entre em contato pelo [opencode@microsoft.com](mailto:opencode@microsoft.com) se tiver outras dúvidas ou comentários.
228+
Este projeto adotou o [Código de Conduta de Código Aberto da Microsoft](https://opensource.microsoft.com/codeofconduct/). Para saber mais, confira as [Perguntas frequentes sobre o Código de Conduta](https://opensource.microsoft.com/codeofconduct/faq/) ou entre em contato pelo [opencode@microsoft.com](mailto:opencode@microsoft.com) se tiver outras dúvidas ou comentários.

README-Localized/README-ru-ru.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,6 @@ import { Client } from "@microsoft/microsoft-graph-client";
6868
```
6969

7070
```typescript
71-
7271
// Configuration options for MSAL @see https://github.com/AzureAD/microsoft-authentication-library-for-js/wiki/MSAL.js-1.0.0-api-release#configuration-options
7372
const msalConfig = {
7473
auth: {

README-Localized/README-zh-cn.md

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,18 +57,17 @@ import { Client } from "@microsoft/microsoft-graph-client";
5757

5858
对于负责获取 `accessToken`[MSAL](https://github.com/AzureAD/microsoft-authentication-library-for-js/tree/dev/lib/msal-core)(Microsoft 身份验证库),Microsoft Graph JavaScript 客户端库拥有适配器实现([ImplicitMSALAuthenticationProvider](src/ImplicitMSALAuthenticationProvider.ts))。MSAL 库不随此库提供,用户需要外部将之包含(对于包含 MSAL,参见“[此处](https://github.com/AzureAD/microsoft-authentication-library-for-js/tree/dev/lib/msal-core#installation)”)。
5959

60-
> **重要说明:**MSAL 仅支持前端应用程序,对于服务器侧身份应用,需要实现自己的AuthenticationProvider。了解如何创建“[自定义身份验证提供程序](./docs/CustomAuthenticationProvider.md)”。
60+
> **重要说明:**MSAL 仅支持前端应用程序,对于服务器侧身份应用,需要实现自己的 AuthenticationProvider。了解如何创建“[自定义身份验证提供程序](./docs/CustomAuthenticationProvider.md)”。
6161
6262
#### 在浏览器环境中创建 ImplicitMSALAuthenticationProvider 实例
6363

64-
有关兼容 msal 版本和下列版本的更新,参见[package.json](./package.json) 中的devDependencies
64+
有关兼容 msal 版本和下列版本的更新,参见[package.json](./package.json) 中的 devDependencies
6565

6666
```html
6767
<script src="https://secure.aadcdn.microsoftonline-p.com/lib/<version>/js/msal.min.js"></script>
6868
```
6969

7070
```typescript
71-
7271
// Configuration options for MSAL @see https://github.com/AzureAD/microsoft-authentication-library-for-js/wiki/MSAL.js-1.0.0-api-release#configuration-options
7372
const msalConfig = {
7473
auth: {
@@ -87,7 +86,7 @@ const authProvider = new MicrosoftGraph.ImplicitMSALAuthenticationProvider(msalA
8786

8887
#### 在节点环境中创建 ImplicitMSALAuthenticationProvider 实例
8988

90-
有关兼容 msal 版本和下列版本的更新,参见[package.json](./package.json) 中的devDependencies
89+
有关兼容 msal 版本和下列版本的更新,参见[package.json](./package.json) 中的 devDependencies
9190

9291
```cmd
9392
npm install msal@<version>

spec/core/urlParsing.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,12 @@ const testCases = {
3737
"/items?$expand=fields($select=Title)&$expand=name($select=firstName)": "https://graph.microsoft.com/v1.0/items?$expand=fields($select=Title),name($select=firstName)",
3838

3939
// Passing invalid parameters
40-
"/me?&test&123": "https://graph.microsoft.com/v1.0/me?&test&123",
40+
"/me?test&123": "https://graph.microsoft.com/v1.0/me?test&123",
4141
"/me?$select($select=name)": "https://graph.microsoft.com/v1.0/me?$select($select=name)",
42+
"/me/?$filter=any(Actors, Name eq 'John Belushi')": "https://graph.microsoft.com/v1.0/me/?$filter=any(Actors, Name eq 'John Belushi')",
43+
"/me/$filter=any(Actors, it/ID eq Director/ID)": "https://graph.microsoft.com/v1.0/me/$filter=any(Actors, it/ID eq Director/ID)",
44+
"/me?$whatif": "https://graph.microsoft.com/v1.0/me?$whatif",
45+
"/me/?$filter=any(Actors a, any(a/Movies m, a/ID eq m/Director/ID))": "https://graph.microsoft.com/v1.0/me/?$filter=any(Actors a, any(a/Movies m, a/ID eq m/Director/ID))",
4246
};
4347

4448
describe("urlParsing.ts", () => {

src/GraphRequest.ts

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -41,14 +41,15 @@ interface KeyValuePairObjectStringNumber {
4141
* @property {string} [path] - The path of the resource request
4242
* @property {KeyValuePairObjectStringNumber} oDataQueryParams - The oData Query Params
4343
* @property {KeyValuePairObjectStringNumber} otherURLQueryParams - The other query params for a request
44+
* @property {string[]} otherURLQueryOptions - The non key-value query parameters. Example- '/me?$whatif'
4445
*/
4546
export interface URLComponents {
4647
host: string;
4748
version: string;
4849
path?: string;
4950
oDataQueryParams: KeyValuePairObjectStringNumber;
5051
otherURLQueryParams: KeyValuePairObjectStringNumber;
51-
otherURLQueryOptions: any[];
52+
otherURLQueryOptions?: string[];
5253
}
5354

5455
/**
@@ -254,7 +255,7 @@ export class GraphRequest {
254255
private parseQueryParameter(queryDictionaryOrString: string | KeyValuePairObjectStringNumber): GraphRequest {
255256
if (typeof queryDictionaryOrString === "string") {
256257
if (queryDictionaryOrString.charAt(0) === "?") {
257-
queryDictionaryOrString = queryDictionaryOrString.substring(1, queryDictionaryOrString.length);
258+
queryDictionaryOrString = queryDictionaryOrString.substring(1);
258259
}
259260

260261
if (queryDictionaryOrString.indexOf("&") !== -1) {
@@ -271,9 +272,6 @@ export class GraphRequest {
271272
this.setURLComponentsQueryParamater(key, queryDictionaryOrString[key]);
272273
}
273274
}
274-
} else {
275-
/*Push values which are not of key-value structure.
276-
Example-> Handle an invalid input->.query(123) and let the Graph API respond with the error in the URL*/ this.urlComponents.otherURLQueryOptions.push(queryDictionaryOrString);
277275
}
278276

279277
return this;
@@ -291,10 +289,10 @@ export class GraphRequest {
291289
if (this.isValidQueryKeyValuePair(queryParameter)) {
292290
const indexOfFirstEquals = queryParameter.indexOf("=");
293291
const paramKey = queryParameter.substring(0, indexOfFirstEquals);
294-
const paramValue = queryParameter.substring(indexOfFirstEquals + 1, queryParameter.length);
292+
const paramValue = queryParameter.substring(indexOfFirstEquals + 1);
295293
this.setURLComponentsQueryParamater(paramKey, paramValue);
296294
} else {
297-
/* Push values which are not of key-value structure.
295+
/* Push values which are not of key-value structure.
298296
Example-> Handle an invalid input->.query(test), .query($select($select=name)) and let the Graph API respond with the error in the URL*/
299297
this.urlComponents.otherURLQueryOptions.push(queryParameter);
300298
}

src/HTTPClient.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ export class HTTPClient {
4242
/**
4343
* @private
4444
* Processes the middleware parameter passed to set this.middleware property
45+
* The calling function should validate if middleware is not undefined or not empty.
4546
* @param {...Middleware} middleware - The middleware passed
4647
* @returns Nothing
4748
*/
@@ -57,6 +58,7 @@ export class HTTPClient {
5758
* @private
5859
* Processes the middleware array to construct the chain
5960
* and sets this.middleware property to the first middlware handler of the array
61+
* The calling function should validate if middleware is not undefined or not empty
6062
* @param {Middleware[]} middlewareArray - The array of middleware handlers
6163
* @returns Nothing
6264
*/

0 commit comments

Comments
 (0)