After updating actions in script editor all the Node.js code deleted

Support
  • Sometimes I face the problem that after updating a script to a newer version of BAS all the Node.js code from the cubes is gone.

    Is there any workaround for this or setting that prevents that behaviour?

  • Updating from which version and to which version did the problem occur? What code was contained in the action?

  • @m4zuper I updated from 26.8.1 to 27.0.0. The node code was just for removing and adding dots from and to a gmail address.

    function generateDotVariants(email, numberOfVariants = 1) {
        const [localPart, domainPart] = email.split('@');
        const variants = new Set();
    
        while (variants.size < numberOfVariants) {
            let dotsCount = Math.floor(Math.random() * 3) + 2; 
            let variantArray = localPart.split('');
            let positions = [];
    
            
            for (let i = 1; i < variantArray.length - 1; i++) {
                if (variantArray[i - 1] !== '.' && variantArray[i] !== '.' && variantArray[i + 1] !== '.') {
                    positions.push(i);
                }
            }
    
            
            for (let i = 0; i < dotsCount; i++) {
                if (positions.length === 0) break; 
    
                const randomIndex = Math.floor(Math.random() * positions.length);
                const dotPosition = positions[randomIndex];
    
                variantArray.splice(dotPosition, 0, '.');
                
                
                positions = positions.filter(pos => Math.abs(pos - dotPosition) > 1);
            }
    
            const variant = variantArray.join('');
            variants.add(variant + '@' + domainPart);
        }
    
        return Array.from(variants);
    }
    
    
    const email = [[FW_ADDRESS]] ;
    const variants = generateDotVariants(email);
    [[FW_ADDRESS_DOT]] = variants;
    [[FW_ADDRESS_DOT]] = [[FW_ADDRESS_DOT]][0]
    
  • @morpheus93
    Can't replicate your problem. Perhaps there are some details? What version of node.js are you using?

  • @m4zuper Sometimes Node.js is also completely disabled after re-opening a project and the code is also gone. Using node version 18.10.0. Don't remember any more details.

  • Can't replicate your problem, are you sure the project wasn't opened simultaneously in multiple copies of BAS?

  • @m4zuper Could be possible that it was opened multiple times but I can't say for sure.

    Btw. what is the recommended way to open a project mulitple times, for copying over cubes? I read to use a copy of the original xml project-file.
    But how to open BAS mulitple times, should be used a separate installation or just open the same BAS (e.g. from the desktop link) 2 or more times?

  • @morpheus93 said in After updating actions in script editor all the Node.js code deleted:

    I read to use a copy of the original xml project-file.

    I can't say for sure, but as an option to re-insure you can do it this way.

    But how to open BAS mulitple times, should be used a separate installation or just open the same BAS (e.g. from the desktop link) 2 or more times?

    You can open the same BAS.