fixes: import/export/clone/versioning for bracket notations references

This commit is contained in:
arpitnath 2024-07-04 19:49:51 +05:30 committed by Kavin Venkatachalam
parent 79511c3154
commit 4ce20a5b03
2 changed files with 23 additions and 0 deletions

View file

@ -443,10 +443,21 @@ export function createReferencesLookup(refState, forQueryParams = false, initalL
return { suggestionList, hintsMap, resolvedRefs };
}
function containsBracketNotation(queryString) {
const bracketNotationRegex = /\[\s*['"][^'"]+['"]\s*\]/;
return bracketNotationRegex.test(queryString);
}
export function findAllEntityReferences(node, allRefs) {
if (typeof node === 'object') {
for (let key in node) {
const value = node[key];
if (typeof value === 'string' && containsBracketNotation(value)) {
//skip if the value is a bracket notation
break;
}
if (
typeof value === 'string' &&
value.includes('{{') &&

View file

@ -25,10 +25,22 @@ export function updateEntityReferences(node, resourceMapping: Record<string, str
return node;
}
function containsBracketNotation(queryString) {
const bracketNotationRegex = /\[\s*['"][^'"]+['"]\s*\]/;
return bracketNotationRegex.test(queryString);
}
export function findAllEntityReferences(node, allRefs): [] {
if (typeof node === 'object') {
for (const key in node) {
const value = node[key];
if (typeof value === 'string' && containsBracketNotation(value)) {
//skip if the value is a bracket notation
break;
}
if (typeof value === 'string' && value.includes('{{') && value.includes('}}')) {
const referenceExists = value;