Skip to content

Commit

Permalink
Chore: Release 9.8.0 (#3066)
Browse files Browse the repository at this point in the history
* Chore(deps): Bump follow-redirects from 1.15.0 to 1.15.6 (#3058)

* Fix: Resource path causing app to crash (#3053)

* Fix: [autocomplete] show dollar sign paths (#3052)

* Fix: Canary urls crashing (#3062)

* Bump version to 9.8.0
  • Loading branch information
ElinorW committed Mar 27, 2024
1 parent a044231 commit 3a9efd3
Show file tree
Hide file tree
Showing 8 changed files with 20 additions and 21 deletions.
10 changes: 5 additions & 5 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
@@ -1,6 +1,6 @@
{
"name": "graph-explorer-v2",
"version": "9.7.0",
"version": "9.8.0",
"private": true,
"dependencies": {
"@augloop/types-core": "file:packages/types-core-2.16.189.tgz",
Expand Down
6 changes: 6 additions & 0 deletions src/app/utils/query-parameter-sanitization.ts
Expand Up @@ -16,6 +16,7 @@ const LAMBDA_OPERATORS = ['/any', '/all'];

// REGEXES
const ALL_ALPHA_REGEX = /^[a-z]+$/i;
const ONE_NUMERIC_REGEX = /^(?=[a-zA-Z]*\d[a-zA-Z]*$)[a-zA-Z\d]*$/;
const POSITIVE_INTEGER_REGEX = /^[1-9]\d*$/;
// Matches media type formats
// Examples: https://www.iana.org/assignments/media-types/media-types.xhtml
Expand Down Expand Up @@ -62,6 +63,10 @@ function isAllAlpha(str: string): boolean {
return ALL_ALPHA_REGEX.test(str);
}

function isAlphaNumeric(str: string): boolean {
return ONE_NUMERIC_REGEX.test(str);
}

function isPlaceHolderSegment(segment: string) {
return segment.startsWith('{') && segment.endsWith('}')
}
Expand Down Expand Up @@ -483,6 +488,7 @@ function sanitizeFilterQueryOptionValue(queryParameterValue: string): string {
export {
isPropertyName,
isAllAlpha,
isAlphaNumeric,
isPlaceHolderSegment,
sanitizeQueryParameter
}
5 changes: 3 additions & 2 deletions src/app/utils/query-url-sanitization.ts
Expand Up @@ -2,6 +2,7 @@
import { IQuery } from '../../types/query-runner';
import {
isAllAlpha,
isAlphaNumeric,
isPlaceHolderSegment,
sanitizeQueryParameter
} from './query-parameter-sanitization';
Expand Down Expand Up @@ -101,13 +102,13 @@ function sanitizedQueryUrl(url: string): string {
* @param segment
*/
function sanitizePathSegment(previousSegment: string, segment: string): string {
const segmentsToIgnore = ['$value', '$count', '$ref', '$batch'];

if (
isAllAlpha(segment) ||
isAlphaNumeric(segment) ||
isDeprecation(segment) ||
SANITIZED_ITEM_PATH_REGEX.test(segment) ||
segmentsToIgnore.includes(segment.toLowerCase()) ||
segment.startsWith('$') ||
ENTITY_NAME_REGEX.test(segment)
) {
return segment;
Expand Down
2 changes: 1 addition & 1 deletion src/app/utils/resources/resources-filter.ts
Expand Up @@ -24,7 +24,7 @@ function getMatchingResourceForUrl(url: string, resources: IResource[]): IResour
let matching = [...resources];
let node;
for (const path of parts) {
if (hasPlaceHolders(path)) {
if (hasPlaceHolders(path) && path !== '{undefined-id}') {
node = matching.find(k => hasPlaceHolders(k.segment));
matching = node?.children || [];
} else {
Expand Down
Expand Up @@ -241,9 +241,9 @@ const AutoComplete = (props: IAutoCompleteProps) => {

const appendSuggestionToUrl = (selected: string) => {
if (!selected) { return; }

const { context } = getLastDelimiterInUrl(queryUrl);
let query = selected;
if (selected.startsWith(delimiters.DOLLAR.symbol)) {
if (selected.startsWith(delimiters.DOLLAR.symbol) && context === 'parameters') {
selected += delimiters.EQUALS.symbol;
query = '';
}
Expand Down
Expand Up @@ -69,7 +69,7 @@ class DocumentationService implements IDocumentationService {
if (matchingResource && matchingResource.labels.length > 0) {
const currentLabel = matchingResource.labels.filter(k => k.name === this.queryVersion)[0];

const method = currentLabel.methods[0];
const method = currentLabel?.methods[0];
if (typeof method === 'string') {
return null;
}
Expand Down
10 changes: 1 addition & 9 deletions src/modules/suggestions/suggestions.ts
Expand Up @@ -52,20 +52,12 @@ class Suggestions implements ISuggestions {
}

private createOpenApiResponse(versionedResources: IResource[], url: string): IParsedOpenApiResponse {
const paths: string[] = [];

versionedResources.forEach((resource: IResource) => {
if (!resource.segment.contains('$')) {
paths.push(resource.segment);
}
});

const response: IParsedOpenApiResponse = {
createdAt: '',
parameters: [{
verb: 'get',
values: [],
links: paths
links: versionedResources.map((resource: IResource) => resource.segment)
}],
url
};
Expand Down

0 comments on commit 3a9efd3

Please sign in to comment.