Skip to content

Nikithauc/merge release 2.1.0 dev #345

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Oct 23, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion README-Localized/README-es-es.md
Original file line number Diff line number Diff line change
Expand Up @@ -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: {
Expand Down
1 change: 0 additions & 1 deletion README-Localized/README-fr-fr.md
Original file line number Diff line number Diff line change
Expand Up @@ -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: {
Expand Down
1 change: 0 additions & 1 deletion README-Localized/README-ja-jp.md
Original file line number Diff line number Diff line change
Expand Up @@ -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: {
Expand Down
3 changes: 1 addition & 2 deletions README-Localized/README-pt-br.md
Original file line number Diff line number Diff line change
Expand Up @@ -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: {
Expand Down Expand Up @@ -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 [[email protected]](mailto:[email protected]) 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 [[email protected]](mailto:[email protected]) se tiver outras dúvidas ou comentários.
1 change: 0 additions & 1 deletion README-Localized/README-ru-ru.md
Original file line number Diff line number Diff line change
Expand Up @@ -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: {
Expand Down
7 changes: 3 additions & 4 deletions README-Localized/README-zh-cn.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)”。
Copy link
Contributor Author

@nikithauc nikithauc Oct 22, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The changes like this were created by the auto formatter while pushing the changes.


#### 在浏览器环境中创建 ImplicitMSALAuthenticationProvider 实例

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

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

```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: {
Expand All @@ -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@<version>
Expand Down
6 changes: 5 additions & 1 deletion spec/core/urlParsing.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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", () => {
Expand Down
12 changes: 5 additions & 7 deletions src/GraphRequest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,15 @@ 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;
version: string;
path?: string;
oDataQueryParams: KeyValuePairObjectStringNumber;
otherURLQueryParams: KeyValuePairObjectStringNumber;
otherURLQueryOptions: any[];
otherURLQueryOptions?: string[];
}

/**
Expand Down Expand Up @@ -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) {
Expand All @@ -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;
Expand All @@ -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);
}
Expand Down
2 changes: 2 additions & 0 deletions src/HTTPClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
*/
Expand All @@ -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
*/
Expand Down