@accordproject/concerto-core
Version:
Core Implementation for the Concerto Modeling Language
53 lines (47 loc) • 1.69 kB
JavaScript
/*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
;
const BaseModelManager = require('./basemodelmanager');
// How to create a modelfile from a cto file
const astProcessFile = (name, data) => {
return {
ast: data,
definitions: null,
fileName: name,
};
};
/**
* Manages the Concerto model files in AST format.
*
* The structure of {@link Resource}s (Assets, Transactions, Participants) is modelled
* in a set of Concerto files. The contents of these files are managed
* by the {@link ModelManager}. Each Concerto file has a single namespace and contains
* a set of asset, transaction and participant type definitions.
*
* Concerto applications load their Concerto files and then call the {@link ModelManager#addModelFile addModelFile}
* method to register the Concerto file(s) with the ModelManager.
*
* @memberof module:concerto-core
*/
class AstModelManager extends BaseModelManager {
/**
* Create the ModelManager.
* @constructor
* @param {object} [options] - Serializer options
*/
constructor(options) {
super(options, astProcessFile);
}
}
module.exports = AstModelManager;