diff --git a/README-Localized/README-es-es.md b/README-Localized/README-es-es.md index de872586d..97ef0641a 100644 --- a/README-Localized/README-es-es.md +++ b/README-Localized/README-es-es.md @@ -68,7 +68,6 @@ Consulte devDependencies en [package.json](./package.json) para ver la versión ``` ```typescript - // Configuration options for MSAL @see https://github.com/AzureAD/microsoft-authentication-library-for-js/wiki/MSAL.js-1.0.0-api-release#configuration-options const msalConfig = { auth: { diff --git a/README-Localized/README-fr-fr.md b/README-Localized/README-fr-fr.md index 465e6a911..fb16cc028 100644 --- a/README-Localized/README-fr-fr.md +++ b/README-Localized/README-fr-fr.md @@ -68,7 +68,6 @@ Reportez-vous à devDependencies dans [package.json](./package.json) pour la ver ``` ```typescript - // Configuration options for MSAL @see https://github.com/AzureAD/microsoft-authentication-library-for-js/wiki/MSAL.js-1.0.0-api-release#configuration-options const msalConfig = { auth: { diff --git a/README-Localized/README-ja-jp.md b/README-Localized/README-ja-jp.md index 9c347ef83..f5d1baaee 100644 --- a/README-Localized/README-ja-jp.md +++ b/README-Localized/README-ja-jp.md @@ -68,7 +68,6 @@ Microsoft Graph JavaScript クライアント ライブラリには、`accessTok ``` ```typescript - // Configuration options for MSAL @see https://github.com/AzureAD/microsoft-authentication-library-for-js/wiki/MSAL.js-1.0.0-api-release#configuration-options const msalConfig = { auth: { diff --git a/README-Localized/README-pt-br.md b/README-Localized/README-pt-br.md index 1ee408fba..7bf45d545 100644 --- a/README-Localized/README-pt-br.md +++ b/README-Localized/README-pt-br.md @@ -68,7 +68,6 @@ Consulte devDependencies no [package.json](./package.json) para a versão msal c ``` ```typescript - // Configuration options for MSAL @see https://github.com/AzureAD/microsoft-authentication-library-for-js/wiki/MSAL.js-1.0.0-api-release#configuration-options const msalConfig = { auth: { @@ -226,4 +225,4 @@ Copyright (c) Microsoft Corporation. Todos os direitos reservados. Licenciado so ## Valorizamos e cumprimos o Código de Conduta de Código Aberto da Microsoft -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. +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. diff --git a/README-Localized/README-ru-ru.md b/README-Localized/README-ru-ru.md index e43fe89d9..cab82c2b8 100644 --- a/README-Localized/README-ru-ru.md +++ b/README-Localized/README-ru-ru.md @@ -68,7 +68,6 @@ import { Client } from "@microsoft/microsoft-graph-client"; ``` ```typescript - // Configuration options for MSAL @see https://github.com/AzureAD/microsoft-authentication-library-for-js/wiki/MSAL.js-1.0.0-api-release#configuration-options const msalConfig = { auth: { diff --git a/README-Localized/README-zh-cn.md b/README-Localized/README-zh-cn.md index 662cac5d5..12a835fef 100644 --- a/README-Localized/README-zh-cn.md +++ b/README-Localized/README-zh-cn.md @@ -57,18 +57,17 @@ import { Client } from "@microsoft/microsoft-graph-client"; 对于负责获取 `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)”)。 -> **重要说明:**MSAL 仅支持前端应用程序,对于服务器侧身份应用,需要实现自己的AuthenticationProvider。了解如何创建“[自定义身份验证提供程序](./docs/CustomAuthenticationProvider.md)”。 +> **重要说明:**MSAL 仅支持前端应用程序,对于服务器侧身份应用,需要实现自己的 AuthenticationProvider。了解如何创建“[自定义身份验证提供程序](./docs/CustomAuthenticationProvider.md)”。 #### 在浏览器环境中创建 ImplicitMSALAuthenticationProvider 实例 -有关兼容 msal 版本和下列版本的更新,参见[package.json](./package.json) 中的devDependencies。 +有关兼容 msal 版本和下列版本的更新,参见[package.json](./package.json) 中的 devDependencies。 ```html ``` ```typescript - // Configuration options for MSAL @see https://github.com/AzureAD/microsoft-authentication-library-for-js/wiki/MSAL.js-1.0.0-api-release#configuration-options const msalConfig = { auth: { @@ -87,7 +86,7 @@ const authProvider = new MicrosoftGraph.ImplicitMSALAuthenticationProvider(msalA #### 在节点环境中创建 ImplicitMSALAuthenticationProvider 实例 -有关兼容 msal 版本和下列版本的更新,参见[package.json](./package.json) 中的devDependencies。 +有关兼容 msal 版本和下列版本的更新,参见[package.json](./package.json) 中的 devDependencies。 ```cmd npm install msal@ diff --git a/spec/core/urlParsing.ts b/spec/core/urlParsing.ts index e73dea023..c1241eac4 100644 --- a/spec/core/urlParsing.ts +++ b/spec/core/urlParsing.ts @@ -37,8 +37,12 @@ const testCases = { "/items?$expand=fields($select=Title)&$expand=name($select=firstName)": "https://graph.microsoft.com/v1.0/items?$expand=fields($select=Title),name($select=firstName)", // Passing invalid parameters - "/me?&test&123": "https://graph.microsoft.com/v1.0/me?&test&123", + "/me?test&123": "https://graph.microsoft.com/v1.0/me?test&123", "/me?$select($select=name)": "https://graph.microsoft.com/v1.0/me?$select($select=name)", + "/me/?$filter=any(Actors, Name eq 'John Belushi')": "https://graph.microsoft.com/v1.0/me/?$filter=any(Actors, Name eq 'John Belushi')", + "/me/$filter=any(Actors, it/ID eq Director/ID)": "https://graph.microsoft.com/v1.0/me/$filter=any(Actors, it/ID eq Director/ID)", + "/me?$whatif": "https://graph.microsoft.com/v1.0/me?$whatif", + "/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))", }; describe("urlParsing.ts", () => { diff --git a/src/GraphRequest.ts b/src/GraphRequest.ts index 2077e5652..7ec736be1 100644 --- a/src/GraphRequest.ts +++ b/src/GraphRequest.ts @@ -41,6 +41,7 @@ interface KeyValuePairObjectStringNumber { * @property {string} [path] - The path of the resource request * @property {KeyValuePairObjectStringNumber} oDataQueryParams - The oData Query Params * @property {KeyValuePairObjectStringNumber} otherURLQueryParams - The other query params for a request + * @property {string[]} otherURLQueryOptions - The non key-value query parameters. Example- '/me?$whatif' */ export interface URLComponents { host: string; @@ -48,7 +49,7 @@ export interface URLComponents { path?: string; oDataQueryParams: KeyValuePairObjectStringNumber; otherURLQueryParams: KeyValuePairObjectStringNumber; - otherURLQueryOptions: any[]; + otherURLQueryOptions?: string[]; } /** @@ -254,7 +255,7 @@ export class GraphRequest { private parseQueryParameter(queryDictionaryOrString: string | KeyValuePairObjectStringNumber): GraphRequest { if (typeof queryDictionaryOrString === "string") { if (queryDictionaryOrString.charAt(0) === "?") { - queryDictionaryOrString = queryDictionaryOrString.substring(1, queryDictionaryOrString.length); + queryDictionaryOrString = queryDictionaryOrString.substring(1); } if (queryDictionaryOrString.indexOf("&") !== -1) { @@ -271,9 +272,6 @@ export class GraphRequest { this.setURLComponentsQueryParamater(key, queryDictionaryOrString[key]); } } - } else { - /*Push values which are not of key-value structure. - Example-> Handle an invalid input->.query(123) and let the Graph API respond with the error in the URL*/ this.urlComponents.otherURLQueryOptions.push(queryDictionaryOrString); } return this; @@ -291,10 +289,10 @@ export class GraphRequest { if (this.isValidQueryKeyValuePair(queryParameter)) { const indexOfFirstEquals = queryParameter.indexOf("="); const paramKey = queryParameter.substring(0, indexOfFirstEquals); - const paramValue = queryParameter.substring(indexOfFirstEquals + 1, queryParameter.length); + const paramValue = queryParameter.substring(indexOfFirstEquals + 1); this.setURLComponentsQueryParamater(paramKey, paramValue); } else { - /* Push values which are not of key-value structure. + /* Push values which are not of key-value structure. Example-> Handle an invalid input->.query(test), .query($select($select=name)) and let the Graph API respond with the error in the URL*/ this.urlComponents.otherURLQueryOptions.push(queryParameter); } diff --git a/src/HTTPClient.ts b/src/HTTPClient.ts index b61dd06ef..c4e866d95 100644 --- a/src/HTTPClient.ts +++ b/src/HTTPClient.ts @@ -42,6 +42,7 @@ export class HTTPClient { /** * @private * Processes the middleware parameter passed to set this.middleware property + * The calling function should validate if middleware is not undefined or not empty. * @param {...Middleware} middleware - The middleware passed * @returns Nothing */ @@ -57,6 +58,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 + * The calling function should validate if middleware is not undefined or not empty * @param {Middleware[]} middlewareArray - The array of middleware handlers * @returns Nothing */