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: Release 9.8.0 #3066

Merged
merged 8 commits into from
Mar 27, 2024
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
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
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Loading