How to use the @accordproject/concerto-core.Logger.info function in @accordproject/concerto-core

To help you get started, we’ve selected a few @accordproject/concerto-core examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github accordproject / cicero / packages / cicero-core / src / templatelibrary.js View on Github external
async getTemplate(templateUri) {
        const cacheKey = this.getTemplateCacheKey(templateUri);

        const result = globalTemplateCache.get(cacheKey);
        if (result) {
            Logger.info('Returning template from cache', templateUri);
            return result;
        }

        const templateUriInfo = TemplateLibrary.parseURI(templateUri);
        const templateIndex = await this.getTemplateIndex();
        const templateMetadata = templateIndex[`${templateUriInfo.templateName}@${templateUriInfo.templateVersion}`];
        if(!templateMetadata) {
            throw new Error(`Failed to find template ${templateUri}`);
        }

        // fetch the template
        const template = await Template.fromUrl(templateMetadata.url);

        // check the hash matches
        const templateHash = template.getHash();
        if(templateHash !== templateUriInfo.templateHash) {
github accordproject / cicero / packages / cicero-core / src / templatelibrary.js View on Github external
async getTemplateIndex(options) {
        const cacheKey = this.getTemplateIndexCacheKey(options);
        const result = globalTemplateIndexCache.get(cacheKey);
        if (result) {
            Logger.info('Returning template index from cache');
            return Promise.resolve(result);
        }

        const httpOptions = {
            uri: `${this.url}/template-library.json`,
            headers: {
                'User-Agent': 'clause',
            },
            json: true, // Automatically parses the JSON string in the response
        };

        Logger.info('Loading template library from', httpOptions.uri);
        return rp(httpOptions)
            .then((templateIndex) => {

                if(options && options.latestVersion) {
github accordproject / cicero / packages / cicero-cli / lib / commands.js View on Github external
static validateInvokeArgs(argv) {
        argv = Commands.validateCommonArgs(argv);
        argv = Commands.setDefaultFileArg(argv, 'sample', 'text/sample.md', ((argv, argDefaultName) => { return path.resolve(argv.template,argDefaultName); }));
        argv = Commands.setDefaultFileArg(argv, 'params', 'params.json', ((argv, argDefaultName) => { return [path.resolve(argv.template,argDefaultName)]; }));

        if(argv.verbose) {
            Logger.info(`initialize sample ${argv.sample} using a template ${argv.template}`);
        }

        return argv;
    }
github accordproject / cicero / packages / cicero-cli / index.js View on Github external
.then((result) => {
                    Logger.info('Completed.');
                })
                .catch((err) => {
github accordproject / cicero / packages / cicero-cli / lib / commands.js View on Github external
static validateTriggerArgs(argv) {
        argv = Commands.validateCommonArgs(argv);
        argv = Commands.setDefaultFileArg(argv, 'sample', 'text/sample.md', ((argv, argDefaultName) => { return path.resolve(argv.template,argDefaultName); }));
        argv = Commands.setDefaultFileArg(argv, 'request', 'request.json', ((argv, argDefaultName) => { return [path.resolve(argv.template,argDefaultName)]; }));
        //argv = Commands.setDefaultFileArg(argv, 'state', 'state.json', ((argv, argDefaultName) => { return path.resolve(argv.template,argDefaultName); }));

        if(argv.verbose) {
            Logger.info(`trigger sample ${argv.sample} using a template ${argv.template} with request ${argv.request} with state ${argv.state}`);
        }

        return argv;
    }
github accordproject / cicero / packages / cicero-cli / index.js View on Github external
.then((result) => {
                    if(result) {Logger.info(JSON.stringify(result));}
                })
                .catch((err) => {
github accordproject / cicero / packages / cicero-cli / index.js View on Github external
}, (argv) => {
        if (argv.verbose) {
            Logger.info(`create contract from data ${argv.data} for template ${argv.template}`);
        }

        try {
            argv = Commands.validateDraftArgs(argv);
            const options = {
                wrapVariables: argv.wrapVariables,
                warnings: argv.warnings,
            };
            return Commands.draft(argv.template, argv.data, argv.output, argv.currentTime, options)
                .then((result) => {
                    if(result) {Logger.info(result);}
                })
                .catch((err) => {
                    Logger.error(err.message);
                });
        } catch (err){
github accordproject / concerto / packages / concerto-cli / index.js View on Github external
.then((result) => {
                Logger.info(result);
            })
            .catch((err) => {
github accordproject / cicero / packages / cicero-cli / lib / commands.js View on Github external
static validateInitializeArgs(argv) {
        argv = Commands.validateCommonArgs(argv);
        argv = Commands.setDefaultFileArg(argv, 'sample', 'text/sample.md', ((argv, argDefaultName) => { return path.resolve(argv.template,argDefaultName); }));

        if(argv.verbose) {
            Logger.info(`initialize sample ${argv.sample} using a template ${argv.template}`);
        }

        return argv;
    }
github accordproject / cicero / packages / cicero-cli / lib / commands.js View on Github external
static validateParseArgs(argv) {
        argv = Commands.validateCommonArgs(argv);
        argv = Commands.setDefaultFileArg(argv, 'sample', 'text/sample.md', ((argv, argDefaultName) => { return path.resolve(argv.template,argDefaultName); }));

        if(argv.verbose) {
            Logger.info(`parse sample ${argv.sample} using a template ${argv.template}`);
        }

        return argv;
    }