UNPKG

@accordproject/concerto-core

Version:

Core Implementation for the Concerto Modeling Language

89 lines (88 loc) 3.87 kB
/** * Converts the contents of a Resource to JSON. The parameters * object should contain the keys * 'stack' - the TypedStack of objects being processed. It should * start with a Resource. * 'modelManager' - the ModelManager to use. * @private * @class * @memberof module:concerto-core */ declare class JSONGenerator { convertResourcesToRelationships: any; permitResourcesForRelationships: any; deduplicateResources: any; convertResourcesToId: any; utcOffset: any; /** * Constructor. * @param {boolean} [convertResourcesToRelationships] Convert resources that * are specified for relationship fields into relationships, false by default. * @param {boolean} [permitResourcesForRelationships] Permit resources in the * place of relationships (serializing them as resources), false by default. * @param {boolean} [deduplicateResources] If resources appear several times * in the object graph only the first instance is serialized, with only the $id * written for subsequent instances, false by default. * @param {boolean} [convertResourcesToId] Convert resources that * @param {boolean} [ergo] - Deprecated - This is a dummy parameter to avoid breaking any consumers. It will be removed in a future release. * are specified for relationship fields into their id, false by default. * @param {number} [utcOffset] UTC Offset for DateTime values. */ constructor(convertResourcesToRelationships?: any, permitResourcesForRelationships?: any, deduplicateResources?: any, convertResourcesToId?: any, ergo?: any, utcOffset?: any); /** * Visitor design pattern * @param {Object} thing - the object being visited * @param {Object} parameters - the parameter * @return {Object} the result of visiting or null * @private */ visit(thing: any, parameters: any): any; /** * Visitor design pattern * @param {MapDeclaration} mapDeclaration - the object being visited * @param {Object} parameters - the parameter * @return {Object} the result of visiting or null * @private */ visitMapDeclaration(mapDeclaration: any, parameters: any): any; /** * Visitor design pattern * @param {ClassDeclaration} classDeclaration - the object being visited * @param {Object} parameters - the parameter * @return {Object} the result of visiting or null * @private */ visitClassDeclaration(classDeclaration: any, parameters: any): any; /** * Visitor design pattern * @param {Field} field - the object being visited * @param {Object} parameters - the parameter * @return {Object} the result of visiting or null * @private */ visitField(field: any, parameters: any): any; /** * Converts to JSON safe format. * * @param {Field} field - the field declaration of the object * @param {Object} obj - the object to convert to text * @return {Object} the text JSON safe representation */ convertToJSON(field: any, obj: any): any; /** * Visitor design pattern * @param {RelationshipDeclaration} relationshipDeclaration - the object being visited * @param {Object} parameters - the parameter * @return {Object} the result of visiting or null * @private */ visitRelationshipDeclaration(relationshipDeclaration: any, parameters: any): any; /** * Returns the persistent format for a relationship. * @param {RelationshipDeclaration} relationshipDeclaration - the relationship being persisted * @param {Identifiable} relationshipOrResource - the relationship or the resource * @returns {string} the text to use to persist the relationship */ getRelationshipText(relationshipDeclaration: any, relationshipOrResource: any): any; } export = JSONGenerator;