Skip to content
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

Chore(deps-dev): Bump node-fetch from 2.6.1 to 3.1.0 #1286

Merged
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
2 changes: 1 addition & 1 deletion .github/workflows/linter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,4 +49,4 @@ jobs:
uses: SonarSource/sonarcloud-github-action@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
2 changes: 1 addition & 1 deletion config/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -397,7 +397,7 @@ module.exports = function (webpackEnv) {
maxChunks: 1
}),
new MonacoWebpackPlugin({
languages: ['json', 'javascript', 'java', 'objective-c', 'csharp', 'html']
languages: ['json', 'javascript', 'java', 'objective-c', 'csharp', 'html', 'powershell', 'go']
}),
// Generates an `index.html` file with the <script> injected.
new HtmlWebpackPlugin(
Expand Down
3,299 changes: 2,102 additions & 1,197 deletions package-lock.json

Large diffs are not rendered by default.

8 changes: 5 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "graph-explorer-v2",
"version": "4.14.0",
"version": "4.16.0",
"private": true,
"dependencies": {
"@augloop/types-core": "file:packages/types-core-2.16.189.tgz",
Expand Down Expand Up @@ -118,6 +118,7 @@
"@typescript-eslint/eslint-plugin": "4.15.0",
"@typescript-eslint/eslint-plugin-tslint": "4.33.0",
"@typescript-eslint/parser": "4.33.0",
"acorn": "8.6.0",
"axe-core": "4.3.3",
"axe-sarif-converter": "2.3.0",
"axios": "0.24.0",
Expand All @@ -135,13 +136,14 @@
"jest-fetch-mock": "3.0.3",
"merge": "2.1.1",
"merge-deep": "3.0.3",
"node-fetch": "2.6.1",
"node-fetch": "3.1.0",
"node-notifier": "10.0.0",
"path-parse": "1.0.7",
"react-dev-utils": "7.0.3",
"react-test-renderer": "16.14.0",
"redux-logger": "3.0.6",
"redux-mock-store": "1.5.3",
"reusify": "1.0.4",
"selenium-webdriver": "4.0.0-beta.4",
"serialize-javascript": "6.0.0",
"ssri": "8.0.1",
Expand All @@ -162,4 +164,4 @@
"reportFile": "test-report.xml",
"indent": 4
}
}
}
23 changes: 1 addition & 22 deletions src/app/middleware/telemetryMiddleware.ts
Original file line number Diff line number Diff line change
@@ -1,19 +1,12 @@
import { SeverityLevel } from '@microsoft/applicationinsights-web';
import {
componentNames,
errorTypes,
eventTypes,
telemetry
} from '../../telemetry';
import { componentNames, errorTypes, telemetry } from '../../telemetry';
import { IAction } from '../../types/action';
import { IQuery } from '../../types/query-runner';
import { IRootState } from '../../types/root';
import {
FETCH_ADAPTIVE_CARD_ERROR,
FETCH_SCOPES_ERROR,
GET_SNIPPET_ERROR,
RESOURCEPATHS_ADD_SUCCESS,
RESOURCEPATHS_DELETE_SUCCESS,
SAMPLES_FETCH_ERROR
} from '../services/redux-constants';
import { sanitizeQueryUrl } from '../utils/query-url-sanitization';
Expand Down Expand Up @@ -62,20 +55,6 @@ const telemetryMiddleware =
);
break;
}
case RESOURCEPATHS_ADD_SUCCESS: {
telemetry.trackEvent(eventTypes.LISTITEM_CLICK_EVENT, {
ComponentName: componentNames.ADD_RESOURCE_TO_COLLECTION_LIST_ITEM,
ResourcePath: action.response[0].url
});
break;
}
case RESOURCEPATHS_DELETE_SUCCESS: {
telemetry.trackEvent(eventTypes.LISTITEM_CLICK_EVENT, {
ComponentName: componentNames.REMOVE_RESOURCE_FROM_COLLECTION_BUTTON,
ResourceCount: action.response.length
});
break;
}
}
return next(action);
};
Expand Down
20 changes: 13 additions & 7 deletions src/app/services/actions/snippet-action-creator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,10 @@ export function getSnippet(language: string): Function {
}
if (language !== 'csharp') {
snippetsUrl += `?lang=${language}`;
if (language === 'go') {
snippetsUrl += '&generation=openapi';
}
}
const openApiSnippets: string[] = ['go', 'powershell'];
if (openApiSnippets.includes(language)) {
snippetsUrl += '&generation=openapi';
}

dispatch(getSnippetPending());
Expand All @@ -52,12 +53,17 @@ export function getSnippet(language: string): Function {
const headers = {
'Content-Type': 'application/http'
};
// eslint-disable-next-line max-len

const requestBody =
sampleQuery.sampleBody &&
Object.keys(sampleQuery.sampleBody).length !== 0 && // check if empty object
sampleQuery.sampleBody.trim() !== ''
? JSON.stringify(sampleQuery.sampleBody)
: '';

const body = `${sampleQuery.selectedVerb} /${queryVersion}/${
requestUrl + search
} HTTP/1.1\r\nHost: graph.microsoft.com\r\nContent-Type: application/json\r\n\r\n${JSON.stringify(
sampleQuery.sampleBody
)}`;
} HTTP/1.1\r\nHost: graph.microsoft.com\r\nContent-Type: application/json\r\n\r\n${requestBody}`;
const options: IRequestOptions = { method, headers, body };
const obj: any = {};

Expand Down
2 changes: 1 addition & 1 deletion src/app/services/redux-constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,4 +49,4 @@ export const GET_POLICY_SUCCESS = 'GET_POLICY_SUCCESS';
export const GET_POLICY_ERROR = 'GET_POLICY_ERROR';
export const GET_POLICY_PENDING = 'GET_POLICY_PENDING';
export const RESOURCEPATHS_ADD_SUCCESS = 'RESOURCEPATHS_ADD_SUCCESS';
export const RESOURCEPATHS_DELETE_SUCCESS = 'RESOURCEPATHS_DELETE_SUCCESS';
export const RESOURCEPATHS_DELETE_SUCCESS = 'RESOURCEPATHS_DELETE_SUCCESS';
10 changes: 10 additions & 0 deletions src/app/utils/download.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
export function downloadToLocal(content: any, filename: string) {
const blob = new Blob([JSON.stringify(content, null, 4)], { type: 'text/json' });

const elem = window.document.createElement('a');
elem.href = window.URL.createObjectURL(blob);
elem.download = filename;
document.body.appendChild(elem);
elem.click();
document.body.removeChild(elem);
}
6 changes: 2 additions & 4 deletions src/app/utils/query-parameter-sanitization.ts
Original file line number Diff line number Diff line change
Expand Up @@ -433,8 +433,7 @@ function sanitizeFilterQueryOptionValue(queryParameterValue: string): string {
if (!isPropertyName(propertyName)) {
propertyName = '<property>';
}
sanitizedQueryString += `${queryFunctionPrefix}(${propertyName}${
commaIndex > 0 ? ',<value>' : ''
sanitizedQueryString += `${queryFunctionPrefix}(${propertyName}${commaIndex > 0 ? ',<value>' : ''
})`;
} else {
sanitizedQueryString += `${queryFunctionPrefix}(<unknown>)`;
Expand All @@ -460,8 +459,7 @@ function sanitizeFilterQueryOptionValue(queryParameterValue: string): string {
COMPARISON_OPERATORS.includes(expectedOperator) ||
ARITHMETIC_OPERATORS.includes(expectedOperator)
) {
sanitizedQueryString += `${segment} ${
filterSegments[index + 1]
sanitizedQueryString += `${segment} ${filterSegments[index + 1]
} <value>`;
index += 2;
continue;
Expand Down
6 changes: 3 additions & 3 deletions src/app/utils/sample-url-generation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export function parseSampleUrl(url: string, version?: string) {
queryVersion = (version) ? version : urlObject.pathname.substring(1, 5);
search = generateSearchParameters(urlObject, search);
sampleUrl = `${GRAPH_URL}/${queryVersion}/${requestUrl + search}`;
} catch (error:any) {
} catch (error: any) {
if (error.message === 'Failed to construct \'URL\': Invalid URL') {
return {
queryVersion, requestUrl, sampleUrl, search
Expand All @@ -33,7 +33,7 @@ function generateSearchParameters(urlObject: URL, search: string) {
try {
search = decodeURI(searchParameters);
}
catch (error:any) {
catch (error: any) {
if (error.message === 'URI malformed') {
search = searchParameters;
}
Expand All @@ -42,7 +42,7 @@ function generateSearchParameters(urlObject: URL, search: string) {
return search;
}

export function hasWhiteSpace(url: string):boolean {
export function hasWhiteSpace(url: string): boolean {
const parts = url.split('?');
const whitespaceChars = [' ', '\t', '\n', '%20'];
return whitespaceChars.some(char => parts[0].includes(char));
Expand Down
2 changes: 1 addition & 1 deletion src/app/utils/status-message.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,4 +85,4 @@ const httpStatusMessage = new Map([
export function setStatusMessage(status: number): string {
const statusMessage = httpStatusMessage.get(status);
return statusMessage ? statusMessage : '';
}
}
25 changes: 0 additions & 25 deletions src/app/views/common/download.ts

This file was deleted.

12 changes: 3 additions & 9 deletions src/app/views/common/monaco/util/format-json.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,8 @@
import { SeverityLevel } from '@microsoft/applicationinsights-web';

import {
componentNames,
errorTypes,
telemetry
} from '../../../../../telemetry';
import { componentNames, errorTypes, telemetry } from '../../../../../telemetry';

export function formatJsonStringForAllBrowsers(
body: string | object | undefined
) {
export function formatJsonStringForAllBrowsers(body: string | object | undefined) {
/**
* 1. Remove whitespace, tabs or raw string (Safari related issue)
* 2. Convert back to javascript object
Expand All @@ -22,7 +16,7 @@ export function formatJsonStringForAllBrowsers(
new Error(errorTypes.OPERATIONAL_ERROR),
SeverityLevel.Error,
{
ComponentName: componentNames.MONACO_EDITOR_FORMAT_JSON_ACTION,
ComponentName: componentNames.MONACO_EDITOR,
Message: `${error}`
}
);
Expand Down
3 changes: 2 additions & 1 deletion src/app/views/query-response/snippets/Snippets.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ function GetSnippets() {
'JavaScript',
'Java',
'Objective-C',
'Go'
'Go',
'PowerShell'
];

return <Pivot>{renderSnippets(supportedLanguages)}</Pivot>;
Expand Down
2 changes: 1 addition & 1 deletion src/app/views/sidebar/history/har-utils.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { IHarFormat, IHarHeaders, IHarPayload } from '../../../../types/har';
import { IHistoryItem } from '../../../../types/history';
import { downloadToLocal } from '../../common/download';
import { downloadToLocal } from '../../../utils/download';

export function createHarPayload(query: IHistoryItem): IHarPayload {
const queryResult = JSON.stringify(query.result);
Expand Down
11 changes: 0 additions & 11 deletions src/app/views/sidebar/resource-explorer/ResourceExplorer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import {
import React, { useEffect, useState } from 'react';
import { FormattedMessage } from 'react-intl';
import { useDispatch, useSelector } from 'react-redux';
import { telemetry, eventTypes, componentNames } from '../../../../telemetry';

import { IResource, IResourceLink, ResourceOptions } from '../../../../types/resources';
import { IRootState } from '../../../../types/root';
Expand Down Expand Up @@ -140,11 +139,6 @@ const unstyledResourceExplorer = (props: any) => {
];
setItems(tree);
setIsolated(navLink);
telemetry.trackEvent(eventTypes.LISTITEM_CLICK_EVENT,
{
ComponentName: componentNames.RESOURCES_ISOLATE_QUERY_LIST_ITEM,
ResourcePath: getUrlFromLink(navLink)
});
}

const disableIsolation = (): void => {
Expand Down Expand Up @@ -174,11 +168,6 @@ const unstyledResourceExplorer = (props: any) => {
context
});
setPanelHeaderText(`${requestUrl}`);
telemetry.trackEvent(eventTypes.LISTITEM_CLICK_EVENT,
{
ComponentName: componentNames.RESOURCES_QUERY_PARAMETERS_LIST_ITEM,
ResourcePath: requestUrl
});
}
}

Expand Down
10 changes: 1 addition & 9 deletions src/app/views/sidebar/resource-explorer/ResourceLink.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import {
import React from 'react';
import { FormattedMessage } from 'react-intl';
import { useDispatch } from 'react-redux';
import { telemetry, eventTypes, componentNames } from '../../../../telemetry';

import { IQuery } from '../../../../types/query-runner';
import { IResourceLink, ResourceOptions } from '../../../../types/resources';
Expand Down Expand Up @@ -34,8 +33,7 @@ const ResourceLink = (props: IResourceLinkProps) => {
};

const setQuery = (link: IResourceLink, selectedVerb: string) => {
const resourceUrl = getUrlFromLink(link);
const sampleUrl = `${GRAPH_URL}/${version}${resourceUrl}`;
const sampleUrl = `${GRAPH_URL}/${version}${getUrlFromLink(link)}`;
const query: IQuery = {
selectedVerb,
selectedVersion: version,
Expand All @@ -44,12 +42,6 @@ const ResourceLink = (props: IResourceLinkProps) => {
sampleBody: undefined
};
dispatch(setSampleQuery(query));
telemetry.trackEvent(eventTypes.LISTITEM_CLICK_EVENT,
{
ComponentName: componentNames.RESOURCES_SET_QUERY_LIST_ITEM,
SelectedVerb: selectedVerb,
ResourcePath: resourceUrl
});
}

const items = getMenuItems();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ import { useDispatch, useSelector } from 'react-redux';
import { IResourceLink, IResourceMethod } from '../../../../../types/resources';
import { IRootState } from '../../../../../types/root';
import { removeResourcePaths } from '../../../../services/actions/resource-explorer-action-creators';
import { downloadToLocal } from '../../../../utils/download';
import { translateMessage } from '../../../../utils/translate-messages';
import { downloadToLocal } from '../../../common/download';
import { removeCounter } from '../resource-explorer.utils';
import Paths from './Paths';
import { generatePostmanCollection } from './postman.util';
Expand Down
6 changes: 4 additions & 2 deletions src/messages/GE_de-DE.json
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,7 @@
"sign in to view a list of all permissions": "Auf dieser Registerkarte fehlen Berechtigungen für die Abfrage. Melden Sie sich an und verwenden Sie die Option \"Berechtigungen auswählen\" im Einstellungssymbol neben Ihrem Profil, um die vollständige Liste der Microsoft Graph-Berechtigungen anzuzeigen, und wählen Sie die gewünschte(n) Berechtigung(en) aus und stimmen Sie diese von dort aus zu.",
"open permissions panel": "Öffnen Sie das Berechtigungsfenster",
"permissions list": " um die vollständige Liste der Microsoft Graph-Berechtigungen anzuzeigen. Wählen Sie die gewünschte(n) Berechtigung(en) aus und stimmen Sie diese(n) von dort aus zu.",
"Get started with adaptive cards on": "Erste Schritte mit angepassten Karten auf",
"Get started with adaptive cards on": "Erste Schritte mit angepassten Karten auf ",
"Adaptive Cards Templating SDK": "Adaptive Cards Templating SDK",
"card": "Karte",
"JSON Schema": "JSON-Vorlage",
Expand Down Expand Up @@ -425,5 +425,7 @@
"Query parameters": "Abfrageparameter",
"Preview collection": "Vorschau der Sammlung",
"Download postman collection": "Postman-Sammlung herunterladen",
"You can export the entire list as a Postman Collection. If there are items in the list you would not want, select them to remove": "Sie können die gesamte Liste als Postman-Sammlung exportieren. Wenn die Liste Elemente enthält, die Sie nicht benötigen, wählen Sie diese aus, um sie zu entfernen."
"You can export the entire list as a Postman Collection. If there are items in the list you would not want, select them to remove": "Sie können die gesamte Liste als Postman-Sammlung exportieren. Wenn die Liste Elemente enthält, die Sie nicht benötigen, wählen Sie diese aus, um sie zu entfernen.",
"Copied": "Kopiert",
"Invalid whitespace in URL": "Ungültige Leerzeichen in URL"
}
6 changes: 4 additions & 2 deletions src/messages/GE_es-ES.json
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,7 @@
"sign in to view a list of all permissions": "Faltan los permisos para realizar la consulta en esta pestaña. Inicie sesión para usar la opción Seleccionar permisos en el icono de configuración junto a su perfil y ver la lista completa de permisos de Microsoft Graph, y seleccione los permisos que desea y consiente desde aquí.",
"open permissions panel": "Abra el panel de permisos",
"permissions list": " para ver la lista completa de permisos de Microsoft Graph y seleccione los permisos que quiere y consiente desde ahí.",
"Get started with adaptive cards on": "Introducción a las tarjetas adaptables en",
"Get started with adaptive cards on": "Introducción a las tarjetas adaptables en ",
"Adaptive Cards Templating SDK": "SDK de plantillas de tarjetas adaptables",
"card": "Tarjeta",
"JSON Schema": "Plantilla JSON",
Expand Down Expand Up @@ -425,5 +425,7 @@
"Query parameters": "Parámetros de consulta",
"Preview collection": "Vista previa de la colección",
"Download postman collection": "Descargar colección Postman",
"You can export the entire list as a Postman Collection. If there are items in the list you would not want, select them to remove": "Se puede exportar toda la lista como una colección de Postman. Si hay elementos en la lista que no desea, selecciónelos para quitarlos."
"You can export the entire list as a Postman Collection. If there are items in the list you would not want, select them to remove": "Se puede exportar toda la lista como una colección de Postman. Si hay elementos en la lista que no desea, selecciónelos para quitarlos.",
"Copied": "Copiado",
"Invalid whitespace in URL": "Espacio en blanco no válido en la dirección URL"
}
Loading