mirror of
https://github.com/ToolJet/ToolJet
synced 2026-05-23 08:58:26 +00:00
fixes: import/export/clone/versioning for bracket notations references
This commit is contained in:
parent
79511c3154
commit
4ce20a5b03
2 changed files with 23 additions and 0 deletions
|
|
@ -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('{{') &&
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue