Skip to content

Commit

Permalink
fix(models): added type defs
Browse files Browse the repository at this point in the history
  • Loading branch information
Stefan Blaginov authored and Stefan Blaginov committed Feb 1, 2024
1 parent 99f0c0f commit 80bdc3e
Show file tree
Hide file tree
Showing 3 changed files with 97 additions and 1 deletion.
1 change: 1 addition & 0 deletions types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ export var CodeGen: {
OpenApiToConcertoVisitor: typeof import("./lib/codegen/fromOpenApi/cto/openApiVisitor");
RustVisitor: typeof import("./lib/codegen/fromcto/rust/rustvisitor");
VocabularyVisitor: typeof import("./lib/codegen/fromcto/vocabulary/vocabularyvisitor");
BenchmarkModelGenerator: typeof import("./lib/common/benchmarkModelGenerator");
formats: {
golang: typeof import("./lib/codegen/fromcto/golang/golangvisitor");
jsonschema: typeof import("./lib/codegen/fromcto/jsonschema/jsonschemavisitor");
Expand Down
3 changes: 2 additions & 1 deletion types/lib/codegen/codegen.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import JSONSchemaToConcertoVisitor = require("./fromJsonSchema/cto/jsonSchemaVis
import OpenApiToConcertoVisitor = require("./fromOpenApi/cto/openApiVisitor");
import RustVisitor = require("./fromcto/rust/rustvisitor");
import VocabularyVisitor = require("./fromcto/vocabulary/vocabularyvisitor");
import BenchmarkModelGenerator = require("../common/benchmarkModelGenerator");
export declare namespace formats {
export { GoLangVisitor as golang };
export { JSONSchemaVisitor as jsonschema };
Expand All @@ -35,4 +36,4 @@ export declare namespace formats {
export { RustVisitor as rust };
export { VocabularyVisitor as vocabulary };
}
export { AbstractPlugin, GoLangVisitor, JSONSchemaVisitor, XmlSchemaVisitor, PlantUMLVisitor, TypescriptVisitor, JavaVisitor, GraphQLVisitor, CSharpVisitor, ODataVisitor, MermaidVisitor, MarkdownVisitor, ProtobufVisitor, OpenApiVisitor, AvroVisitor, JSONSchemaToConcertoVisitor, OpenApiToConcertoVisitor, RustVisitor, VocabularyVisitor };
export { AbstractPlugin, GoLangVisitor, JSONSchemaVisitor, XmlSchemaVisitor, PlantUMLVisitor, TypescriptVisitor, JavaVisitor, GraphQLVisitor, CSharpVisitor, ODataVisitor, MermaidVisitor, MarkdownVisitor, ProtobufVisitor, OpenApiVisitor, AvroVisitor, JSONSchemaToConcertoVisitor, OpenApiToConcertoVisitor, RustVisitor, VocabularyVisitor, BenchmarkModelGenerator };
94 changes: 94 additions & 0 deletions types/lib/common/benchmarkModelGenerator.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
export = BenchmarkModelGenerator;
/**
* Generate a benchmark model.
*
* @class
*/
declare class BenchmarkModelGenerator {
/**
* Formats the given byte size into a human-readable string.
* @param {number} bytes The number of bytes.
* @param {number} [decimals=2] The number of decimal places to include.
* @returns {string} A formatted string representing the byte size.
*/
formatBytes(bytes: number, decimals?: number): string;
/**
* Calculates the size of a JSON object in bytes.
* @param {Object} json The JSON object to measure.
* @returns {number} The size of the JSON object in bytes.
*/
jsonSize(json: any): number;
/**
* Gathers statistics about the number of properties in declarations.
* @param {Array} declarations An array of declaration objects.
* @returns {Object} An object containing statistics about the properties.
*/
gatherPropertiesNStats(declarations: any[]): any;
/**
* Generates a unique name based on a seed value.
* @param {Object} params The indexes of the generated components.
* @returns {string} A unique name.
*/
generateName({ modelI, declarationI, propertyI, }: any): string;
/**
* Generates a property object.
* @param {Object} params An object containing indices for model, declaration, and property.
* @returns {Object} A property object.
*/
generateProperty({ modelI, declarationI, propertyI, }: any): any;
/**
* Generates multiple property objects.
* @param {Object} params An object containing model index, declaration index, and the number of properties.
* @returns {Array<Object>} An array of property objects.
*/
generateNProperties({ modelI, declarationI, nProperties, }: any): Array<any>;
/**
* Generates property objects up to a specified size.
* @param {Object} params An object containing model index, declaration index, and a size budget for properties.
* @returns {Array<Object>} An array of property objects within the specified size budget.
*/
generatePropertiesUpToSize({ modelI, declarationI, propertiesSizeBudget, }: any): Array<any>;
/**
* Generates a declaration object with a specified number of properties.
* @param {Object} params An object containing model index, declaration index, and the number of properties.
* @returns {Object} A declaration object.
*/
generateDeclarationWithNProperties({ modelI, declarationI, nProperties, }: any): any;
/**
* Generates a declaration object to a specified size.
* @param {Object} params An object containing model index, declaration index, and a size budget for the declaration.
* @returns {Object} A declaration object within the specified size budget.
*/
generateDeclarationToSize({ modelI, declarationI, declarationSizeBudget, }: any): any;
/**
* Generates multiple declarations with properties, aiming to fit within a size budget by adding declarations.
* @param {Object} params An object containing model index, a size budget for declarations, and the number of properties per declaration.
* @returns {Array<Object>} An array of declaration objects.
*/
generateDeclarationsToSizeGrowByDeclarations({ modelI, declarationsSizeBudget, nProperties, }: any): Array<any>;
/**
* Generates multiple declarations with properties, distributing the size budget across properties within declarations.
* @param {Object} params An object containing model index, a size budget for declarations, and the number of declarations.
* @returns {Array<Object>} An array of declaration objects.
*/
generateDeclarationsToSizeGrowByProperties({ modelI, declarationsSizeBudget, nDeclarations, }: any): Array<any>;
/**
* Generates declarations according to a specified size budget and growth strategy.
* @param {Object} params An object containing model index, size budget, number of declarations, number of properties, and growth strategy.
* @returns {Array<Object>} An array of declaration objects according to the specified growth strategy.
*/
generateDeclarationsToSize({ modelI, declarationsSizeBudget, nDeclarations, nProperties, growBy, }: any): Array<any>;
/**
* Generates a specified number of declarations, each with a fixed number of properties.
* @param {Object} params An object containing model index, the number of declarations, and the number of properties per declaration.
* @returns {Array<Object>} An array of declaration objects.
*/
generateNDeclarations({ modelI, nDeclarations, nProperties, }: any): Array<any>;
/**
* Generates a Concerto model with specified parameters, optionally generating up to a size limit.
* @param {Object} params An object containing parameters for the model generation, such as metamodel version, namespace, version, indices, and size constraints.
* @returns {Object} An object containing the generated model and metadata about the generation process.
* @public
*/
public generateConcertoModels({ concertoMetamodelVersion, modelNamespace, modelVersion, modelI, generateUpToSize, growBy, nDeclarations, nProperties, }: any): any;
}

0 comments on commit 80bdc3e

Please sign in to comment.