@accordproject/concerto-core
Version:
Core Implementation for the Concerto Modeling Language
50 lines (49 loc) • 2.19 kB
TypeScript
import type { FileLoader } from '@accordproject/concerto-util';
import type { ModelManagerOptions } from './types';
import ModelFile = require('./introspect/modelfile');
import ModelManager = require('./modelmanager');
type ModelLoaderOptions = ModelManagerOptions & {
offline?: boolean;
};
/**
* Create a ModelManager from model files, with an optional system model.
*
* If a ctoFile is not provided, the Accord Project system model is used.
*
* @class
* @memberof module:concerto-core
*/
declare class ModelLoader {
/**
* Add model file
*
* @param {object} modelFileLoader - the model loader
* @param {object} modelManager - the model manager
* @param {string} ctoFile - the model file
* @return {Promise<ModelManager>} the model manager
* @private
*/
static addModel(modelFileLoader: FileLoader<ModelFile>, modelManager: ModelManager, ctoFile: string): Promise<ModelManager>;
/**
* Load models in a new model manager
*
* @param {string[]} ctoFiles - the CTO files (can be local file paths or URLs)
* @param {object} options - optional parameters
* @param {boolean} [options.offline] - do not resolve external models
* @param {number} [options.utcOffset] - UTC Offset for this execution
* @return {Promise<ModelManager>} the model manager
*/
static loadModelManager(ctoFiles: string[], options?: ModelLoaderOptions): Promise<ModelManager>;
/**
* Load system and models in a new model manager from model files objects
*
* @param {object[]} modelFiles - An array of Concerto files as strings or ModelFile objects.
* @param {string[]} [fileNames] - An optional array of file names to associate with the model files
* @param {object} options - optional parameters
* @param {boolean} [options.offline] - do not resolve external models
* @param {number} [options.utcOffset] - UTC Offset for this execution
* @return {Promise<ModelManager>} the model manager
*/
static loadModelManagerFromModelFiles(modelFiles: Array<string | ModelFile>, fileNames?: string[], options?: ModelLoaderOptions): Promise<ModelManager>;
}
export = ModelLoader;