@accordproject/markdown-common
Version:
A framework for transforming markdown
300 lines (239 loc) • 7.3 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.
*/
'use strict';
const NAMESPACE = 'concerto.metamodel@1.0.0';
const MODEL = `
/*
* 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.
*/
concerto version "^3.0.0"
namespace concerto.metamodel@1.0.0
concept Position {
o Integer line
o Integer column
o Integer offset
}
concept Range {
o Position start
o Position end
o String source optional
}
concept TypeIdentifier {
o String name
o String namespace optional
}
abstract concept DecoratorLiteral {
o Range location optional
}
concept DecoratorString extends DecoratorLiteral {
o String value
}
concept DecoratorNumber extends DecoratorLiteral {
o Double value
}
concept DecoratorBoolean extends DecoratorLiteral {
o Boolean value
}
concept DecoratorTypeReference extends DecoratorLiteral {
o TypeIdentifier type
o Boolean isArray default=false
}
concept Decorator {
o String name
o DecoratorLiteral[] arguments optional
o Range location optional
}
concept Identified {
}
concept IdentifiedBy extends Identified {
o String name
}
abstract concept Declaration {
o String name regex=/^(\\p{Lu}|\\p{Ll}|\\p{Lt}|\\p{Lm}|\\p{Lo}|\\p{Nl}|\\$|_|\\\\u[0-9A-Fa-f]{4})(?:\\p{Lu}|\\p{Ll}|\\p{Lt}|\\p{Lm}|\\p{Lo}|\\p{Nl}|\\$|_|\\\\u[0-9A-Fa-f]{4}|\\p{Mn}|\\p{Mc}|\\p{Nd}|\\p{Pc}|\\u200C|\\u200D)*$/u
o Decorator[] decorators optional
o Range location optional
}
abstract concept MapKeyType {
o Decorator[] decorators optional
o Range location optional
}
abstract concept MapValueType {
o Decorator[] decorators optional
o Range location optional
}
concept MapDeclaration extends Declaration {
o MapKeyType key
o MapValueType value
}
concept StringMapKeyType extends MapKeyType {}
concept DateTimeMapKeyType extends MapKeyType {}
concept ObjectMapKeyType extends MapKeyType {
o TypeIdentifier type
}
concept BooleanMapValueType extends MapValueType {}
concept DateTimeMapValueType extends MapValueType {}
concept StringMapValueType extends MapValueType {}
concept IntegerMapValueType extends MapValueType {}
concept LongMapValueType extends MapValueType {}
concept DoubleMapValueType extends MapValueType {}
concept ObjectMapValueType extends MapValueType {
o TypeIdentifier type
}
concept RelationshipMapValueType extends MapValueType {
o TypeIdentifier type
}
concept EnumDeclaration extends Declaration {
o EnumProperty[] properties
}
concept EnumProperty {
o String name regex=/^(\\p{Lu}|\\p{Ll}|\\p{Lt}|\\p{Lm}|\\p{Lo}|\\p{Nl}|\\$|_|\\\\u[0-9A-Fa-f]{4})(?:\\p{Lu}|\\p{Ll}|\\p{Lt}|\\p{Lm}|\\p{Lo}|\\p{Nl}|\\$|_|\\\\u[0-9A-Fa-f]{4}|\\p{Mn}|\\p{Mc}|\\p{Nd}|\\p{Pc}|\\u200C|\\u200D)*$/u
o Decorator[] decorators optional
o Range location optional
}
concept ConceptDeclaration extends Declaration {
o Boolean isAbstract default=false
o Identified identified optional
o TypeIdentifier superType optional
o Property[] properties
}
concept AssetDeclaration extends ConceptDeclaration {
}
concept ParticipantDeclaration extends ConceptDeclaration {
}
concept TransactionDeclaration extends ConceptDeclaration {
}
concept EventDeclaration extends ConceptDeclaration {
}
abstract concept Property {
o String name regex=/^(\\p{Lu}|\\p{Ll}|\\p{Lt}|\\p{Lm}|\\p{Lo}|\\p{Nl}|\\$|_|\\\\u[0-9A-Fa-f]{4})(?:\\p{Lu}|\\p{Ll}|\\p{Lt}|\\p{Lm}|\\p{Lo}|\\p{Nl}|\\$|_|\\\\u[0-9A-Fa-f]{4}|\\p{Mn}|\\p{Mc}|\\p{Nd}|\\p{Pc}|\\u200C|\\u200D)*$/u
o Boolean isArray default=false
o Boolean isOptional default=false
o Decorator[] decorators optional
o Range location optional
}
concept RelationshipProperty extends Property {
o TypeIdentifier type
}
concept ObjectProperty extends Property {
o String defaultValue optional
o TypeIdentifier type
}
concept BooleanProperty extends Property {
o Boolean defaultValue optional
}
concept DateTimeProperty extends Property {
}
concept StringProperty extends Property {
o String defaultValue optional
o StringRegexValidator validator optional
o StringLengthValidator lengthValidator optional
}
concept StringRegexValidator {
o String pattern
o String flags
}
concept StringLengthValidator {
o Integer minLength optional
o Integer maxLength optional
}
concept DoubleProperty extends Property {
o Double defaultValue optional
o DoubleDomainValidator validator optional
}
concept DoubleDomainValidator {
o Double lower optional
o Double upper optional
}
concept IntegerProperty extends Property {
o Integer defaultValue optional
o IntegerDomainValidator validator optional
}
concept IntegerDomainValidator {
o Integer lower optional
o Integer upper optional
}
concept LongProperty extends Property {
o Long defaultValue optional
o LongDomainValidator validator optional
}
concept LongDomainValidator {
o Long lower optional
o Long upper optional
}
concept AliasedType{
o String name
o String aliasedName
}
abstract concept Import {
o String namespace
o String uri optional
}
concept ImportAll extends Import {
}
concept ImportType extends Import {
o String name
}
concept ImportTypes extends Import {
o String[] types
o AliasedType[] aliasedTypes optional
}
concept Model {
o String namespace
o String sourceUri optional
o String concertoVersion optional
o Import[] imports optional
o Declaration[] declarations optional
o Decorator[] decorators optional
}
concept Models {
o Model[] models
}
abstract concept ScalarDeclaration extends Declaration {
}
concept BooleanScalar extends ScalarDeclaration {
o Boolean defaultValue optional
}
concept IntegerScalar extends ScalarDeclaration {
o Integer defaultValue optional
o IntegerDomainValidator validator optional
}
concept LongScalar extends ScalarDeclaration {
o Long defaultValue optional
o LongDomainValidator validator optional
}
concept DoubleScalar extends ScalarDeclaration {
o Double defaultValue optional
o DoubleDomainValidator validator optional
}
concept StringScalar extends ScalarDeclaration {
o String defaultValue optional
o StringRegexValidator validator optional
o StringLengthValidator lengthValidator optional
}
concept DateTimeScalar extends ScalarDeclaration {
o String defaultValue optional
}
`;
module.exports = { NAMESPACE, MODEL };