_prepareExtensionInfo (serviceName, extensionInfo) {
        extensionInfo = Object.assign({}, extensionInfo);
        extensionInfo.id = this._sanitizeID(extensionInfo.id);
        extensionInfo.name = extensionInfo.name || extensionInfo.id;
        extensionInfo.blocks = extensionInfo.blocks || [];
        extensionInfo.targetTypes = extensionInfo.targetTypes || [];
        extensionInfo.blocks = extensionInfo.blocks.reduce((result, blockInfo) => {
            try {
                result.push(this._prepareBlockInfo(serviceName, blockInfo));
            } catch (e) {
                // TODO: more meaningful error reporting
                log.error(`Error processing block: ${e.message}, Block:\n${JSON.stringify(blockInfo)}`);
            }
            return result;
        }, []);
        return extensionInfo;
    }
/**
     * Apply minor cleanup and defaults for optional extension fields.
     * TODO: make the ID unique in cases where two copies of the same extension are loaded.
     * @param {string} serviceName - the name of the service hosting this extension block
     * @param {ExtensionInfo} extensionInfo - the extension info to be sanitized
     * @returns {ExtensionInfo} - a new extension info object with cleaned-up values
     * @private
     */
Apply minor cleanup and defaults for optional extension fields.
TODO: make the ID unique in cases where two copies of the same extension are loaded.
@param {string} serviceName - the name of the service hosting this extension block
@param {ExtensionInfo} extensionInfo - the extension info to be sanitized
@returns {ExtensionInfo} - a new extension info object with cleaned-up values
@private
Apply minor cleanup and defaults for optional extension fields . TODO : make the ID unique in cases where two copies of the same extension are loaded . @param { string } serviceName - the name of the service hosting this extension block @param { ExtensionInfo } extensionInfo - the extension info to be sanitized @returns { ExtensionInfo } - a new extension info object with cleaned - up values @private
_prepareExtensionInfo (serviceName, extensionInfo) {
        extensionInfo = Object.assign({}, extensionInfo);
        extensionInfo.id = this._sanitizeID(extensionInfo.id);
        extensionInfo.name = extensionInfo.name || extensionInfo.id;
        extensionInfo.blocks = extensionInfo.blocks || [];
        extensionInfo.targetTypes = extensionInfo.targetTypes || [];
        extensionInfo.blocks = extensionInfo.blocks.reduce((result, blockInfo) => {
            try {
                result.push(this._prepareBlockInfo(serviceName, blockInfo));
            } catch (e) {
                log.error(`Error processing block: ${e.message}, Block:\n${JSON.stringify(blockInfo)}`);
            }
            return result;
        }, []);
        return extensionInfo;
    }
_prepareExtensionInfo ( serviceName , extensionInfo ) { extensionInfo = Object . assign ( { } , extensionInfo ) ; extensionInfo . id = this . _sanitizeID ( extensionInfo . id ) ; extensionInfo . name = extensionInfo . name || extensionInfo . id ; extensionInfo . blocks = extensionInfo . blocks || [ ] ; extensionInfo . targetTypes = extensionInfo . targetTypes || [ ] ; extensionInfo . blocks = extensionInfo . blocks . reduce ( ( result , blockInfo ) => { try { result . push ( this . _prepareBlockInfo ( serviceName , blockInfo ) ) ; } catch ( e ) { log . error ( ` ${ e . message } \n ${ JSON . stringify ( blockInfo ) } ` ) ; } return result ; } , [ ] ) ; return extensionInfo ; }
Apply minor cleanup and defaults for optional extension fields.
Apply minor cleanup and defaults for optional extension fields .
// TODO: more meaningful error reporting