Skip to content

Commit

Permalink
chore(build) Recreate TypeScript interfaces for the new packages
Browse files Browse the repository at this point in the history
Signed-off-by: jeromesimeon <[email protected]>
  • Loading branch information
jeromesimeon committed Dec 1, 2021
1 parent 6977dd4 commit 6165d1c
Show file tree
Hide file tree
Showing 24 changed files with 454 additions and 12 deletions.
2 changes: 1 addition & 1 deletion packages/concerto-core/api.txt
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ class MetaModel {
+ object modelManagerFromMetaModel(object,boolean?)
}
class ModelFile {
+ void constructor(ModelManager,object,string,string?) throws IllegalModelException
+ void constructor(ModelManager,object,string?,string?) throws IllegalModelException
+ boolean isModelFile()
+ Boolean isSystemModelFile()
+ boolean isExternal()
Expand Down
2 changes: 1 addition & 1 deletion packages/concerto-core/changelog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
# Note that the latest public API is documented using JSDocs and is available in api.txt.
#

Version 1.2.2 {f9142bfb889e33e7f04f95fa9a4171aa} 2021-11-24
Version 1.2.2 {f3671c1416edd096c788dffd63639b48} 2021-11-24
- Remove custom instanceof and add methods to check runtime type
- Remove support for Node 12
- Generate Typescript definitions from JSDoc
Expand Down
2 changes: 1 addition & 1 deletion packages/concerto-core/lib/introspect/modelfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class ModelFile {
* @param {ModelManager} modelManager - the ModelManager that manages this
* ModelFile
* @param {object} ast - The DSL model as a string.
* @param {string} definitions - The DSL model as a string.
* @param {string} [definitions] - The (optional) CTO model as a string.
* @param {string} [fileName] - The optional filename for this modelfile
* @throws {IllegalModelException}
*/
Expand Down
2 changes: 0 additions & 2 deletions packages/concerto-core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,6 @@
"dependencies": {
"@accordproject/concerto-util": "1.2.1",
"@accordproject/concerto-cto": "1.2.1",
"@supercharge/promise-pool": "1.7.0",
"axios": "0.23.0",
"dayjs": "1.10.4",
"debug": "4.3.1",
"lorem-ipsum": "2.0.3",
Expand Down
4 changes: 2 additions & 2 deletions packages/concerto-cto/lib/parserMain.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ const ParseException = require('./parseexception');

/**
* Create decorator argument string from a metamodel
* @param {object} cto - the Concerto string
* @param {string} cto - the Concerto string
* @param {string} [fileName] - an optional file name
* @return {string} the string for the decorator argument
* @return {object} the string for the decorator argument
*/
function parse(cto, fileName) {
try {
Expand Down
4 changes: 3 additions & 1 deletion packages/concerto-cto/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
"npm": ">=6"
},
"main": "index.js",
"typings": "types/index.d.ts",
"scripts": {
"pretest": "npm run lint",
"lint": "eslint .",
Expand All @@ -18,7 +19,8 @@
"test": "nyc mocha --recursive -t 10000",
"test:watch": "nyc mocha --watch --recursive -t 10000",
"mocha": "mocha --recursive -t 10000",
"nyc": "nyc mocha --recursive -t 10000"
"nyc": "nyc mocha --recursive -t 10000",
"build:types" : "npx -p typescript tsc ./lib/*.js index.js --declaration --allowJs --emitDeclarationOnly --outDir types"
},
"repository": {
"type": "git",
Expand Down
5 changes: 5 additions & 0 deletions packages/concerto-cto/types/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
export var BaseException: typeof import("./lib/baseexception");
export var BaseFileException: typeof import("./lib/basefileexception");
export var ParseException: typeof import("./lib/parseexception");
export var Parser: typeof import("./lib/parserMain");
export var Printer: typeof import("./lib/printer");
16 changes: 16 additions & 0 deletions packages/concerto-cto/types/lib/baseexception.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
export = BaseException;
/**
* A base class for all Concerto exceptions
* @extends Error
* @class
* @memberof module:concerto-core
*/
declare class BaseException extends Error {
/**
* Create the BaseException.
* @param {string} message - The exception message.
* @param {string} component - The optional component which throws this error.
*/
constructor(message: string, component: string);
component: any;
}
38 changes: 38 additions & 0 deletions packages/concerto-cto/types/lib/basefileexception.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
export = BaseFileException;
/**
* Exception throws when a Concerto file is semantically invalid
* @extends BaseException
* @see {@link BaseException}
* @class
* @memberof module:concerto-core
*/
declare class BaseFileException extends BaseException {
/**
* Create an BaseFileException
* @param {string} message - the message for the exception
* @param {string} fileLocation - the optional file location associated with the exception
* @param {string} fullMessage - the optional full message text
* @param {string} [fileName] - the file name
* @param {string} [component] - the component which throws this error
*/
constructor(message: string, fileLocation: string, fullMessage: string, fileName?: string, component?: string);
fileLocation: string;
shortMessage: string;
fileName: string;
/**
* Returns the file location associated with the exception or null
* @return {string} the optional location associated with the exception
*/
getFileLocation(): string;
/**
* Returns the error message without the location of the error
* @returns {string} the error message
*/
getShortMessage(): string;
/**
* Returns the fileName for the error
* @returns {string} the file name or null
*/
getFileName(): string;
}
import BaseException = require("./baseexception");
21 changes: 21 additions & 0 deletions packages/concerto-cto/types/lib/parseexception.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
export = ParseException;
/**
* Exception throws when a Concerto file is syntactically invalid
* @extends BaseFileException
* @see See {@link BaseFileException}
* @class
* @memberof module:concerto-core
* @private
*/
declare class ParseException extends BaseFileException {
/**
* Create an ParseException
* @param {string} message - the message for the exception
* @param {string} [fileLocation] - the file location associated with the exception
* @param {string} [fileName] - the file name associated with the exception
* @param {string} [fullMessageOverride] - the pre-existing full message
* @param {string} [component] - the component which throws this error
*/
constructor(message: string, fileLocation?: string, fileName?: string, fullMessageOverride?: string, component?: string);
}
import BaseFileException = require("./basefileexception");
10 changes: 10 additions & 0 deletions packages/concerto-cto/types/lib/parser.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
declare function peg$SyntaxError(message: any, expected: any, found: any, location: any): any;
declare class peg$SyntaxError {
constructor(message: any, expected: any, found: any, location: any);
format(sources: any): string;
}
declare namespace peg$SyntaxError {
function buildMessage(expected: any, found: any): string;
}
declare function peg$parse(input: any, options: any): any;
export { peg$SyntaxError as SyntaxError, peg$parse as parse };
7 changes: 7 additions & 0 deletions packages/concerto-cto/types/lib/parserMain.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
/**
* Create decorator argument string from a metamodel
* @param {string} cto - the Concerto string
* @param {string} [fileName] - an optional file name
* @return {object} the string for the decorator argument
*/
export function parse(cto: string, fileName?: string): object;
6 changes: 6 additions & 0 deletions packages/concerto-cto/types/lib/printer.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
/**
* Create a model string from a metamodel
* @param {object} metaModel - the metamodel
* @return {string} the string for that model
*/
export function toCTO(metaModel: object): string;
6 changes: 3 additions & 3 deletions packages/concerto-util/README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# Concerto Core
# Concerto Utilities

Main library for Concerto models, model manager, JSON instance validation and serialization.
Those are various utilities independent of Concerto itself covering things like: logging, external files downloads, stacks etc.

# Installation

```
npm install @accordproject/concerto-core --save
npm install @accordproject/concerto-util --save
```

## License <a name="license"></a>
Expand Down
4 changes: 3 additions & 1 deletion packages/concerto-util/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
"npm": ">=6"
},
"main": "index.js",
"typings": "types/index.d.ts",
"scripts": {
"pretest": "npm run lint",
"lint": "eslint .",
Expand All @@ -18,7 +19,8 @@
"test": "nyc mocha --recursive -t 10000",
"test:watch": "nyc mocha --watch --recursive -t 10000",
"mocha": "mocha --recursive -t 10000",
"nyc": "nyc mocha --recursive -t 10000"
"nyc": "nyc mocha --recursive -t 10000",
"build:types" : "npx -p typescript tsc ./lib/**/*.js index.js --declaration --allowJs --emitDeclarationOnly --outDir types"
},
"repository": {
"type": "git",
Expand Down
8 changes: 8 additions & 0 deletions packages/concerto-util/types/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
export var FileDownloader: typeof import("./lib/filedownloader");
export var CompositeFileLoader: typeof import("./lib/loaders/compositefileloader");
export var DefaultFileLoader: typeof import("./lib/loaders/defaultfileloader");
export var GitHubFileLoader: typeof import("./lib/loaders/githubfileloader");
export var HTTPFileLoader: typeof import("./lib/loaders/httpfileloader");
export var Writer: typeof import("./lib/writer");
export var Logger: typeof import("./lib/logger");
export var TypedStack: typeof import("./lib/typedstack");
32 changes: 32 additions & 0 deletions packages/concerto-util/types/lib/filedownloader.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
export = FileDownloader;
/**
* Downloads the transitive closure of a set of model files.
* @class
* @memberof module:concerto-core
*/
declare class FileDownloader {
/**
* Create a FileDownloader and bind to a FileLoader.
* @param {fileLoader} fileLoader - the loader to use to download model files
* @param {*} getExternalImports - a function taking a file and returning new files
* @param {Number} concurrency - the number of model files to download concurrently
*/
constructor(fileLoader: fileLoader, getExternalImports: any, concurrency?: number);
fileLoader: fileLoader;
concurrency: number;
getExternalImports: any;
/**
* Download all external dependencies for an array of model files
* @param {File[]} files - the model files
* @param {Object} [options] - Options object passed to FileLoaders
* @return {Promise} a promise that resolves to Files[] for the external model files
*/
downloadExternalDependencies(files: File[], options?: any): Promise<any>;
/**
* Execute a Job
* @param {Object} job - the job to execute
* @param {Object} fileLoader - the loader to use to download model files.
* @return {Promise} a promise to the job results
*/
runJob(job: any, fileLoader: any): Promise<any>;
}
42 changes: 42 additions & 0 deletions packages/concerto-util/types/lib/loaders/compositefileloader.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
export = CompositeFileLoader;
/**
* <p>
* Manages a set of model file loaders, delegating to the first model file
* loader that accepts a URL.
* </p>
* @private
* @class
* @memberof module:concerto-util
*/
declare class CompositeFileLoader {
fileLoaders: any[];
/**
* Adds a FileLoader implemenetation to the FileLoader
* @param {FileLoader} fileLoader - The script to add to the ScriptManager
*/
addFileLoader(fileLoader: FileLoader): void;
/**
* Get the array of FileLoader instances
* @return {FileLoaders[]} The FileLoader registered
* @private
*/
private getFileLoaders;
/**
* Remove all registered FileLoaders
*/
clearFileLoaders(): void;
/**
* Returns true if this ModelLoader can process the URL
* @param {string} url - the URL
* @return {boolean} true if this ModelLoader accepts the URL
* @abstract
*/
accepts(url: string): boolean;
/**
* Load a File from a URL and return it
* @param {string} url - the url to get
* @param {object} options - additional options
* @return {Promise} a promise to the File
*/
load(url: string, options: object): Promise<any>;
}
19 changes: 19 additions & 0 deletions packages/concerto-util/types/lib/loaders/defaultfileloader.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
export = DefaultFileLoader;
/**
* <p>
* A default CompositeFileLoader implementation which supports
* github://, http:// and https:// URLs.
* </p>
* @private
* @class
* @see See {@link CompositeFileLoader}
* @memberof module:concerto-util
*/
declare class DefaultFileLoader extends CompositeFileLoader {
/**
* Create the DefaultFileLoader.
* @param {*} processFile - a function to apply to the content of the file
*/
constructor(processFile: any);
}
import CompositeFileLoader = require("./compositefileloader");
11 changes: 11 additions & 0 deletions packages/concerto-util/types/lib/loaders/githubfileloader.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
export = GitHubFileLoader;
/**
* Loads Files from an external source, such as a URL.
*
* @class
* @private
* @memberof module:concerto-util
*/
declare class GitHubFileLoader extends HTTPFileLoader {
}
import HTTPFileLoader = require("./httpfileloader");
29 changes: 29 additions & 0 deletions packages/concerto-util/types/lib/loaders/httpfileloader.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
export = HTTPFileLoader;
/**
* Loads Files from an HTTP(S) URL using the axios library.
* @class
* @private
* @memberof module:concerto-util
*/
declare class HTTPFileLoader {
/**
* Create the HTTPFileLoader.
* @param {*} processFile - a function to apply to the content of the file
*/
constructor(processFile: any);
processFile: any;
/**
* Returns true if this ModelLoader can process the URL
* @param {string} url - the URL
* @return {boolean} true if this ModelLoader accepts the URL
* @abstract
*/
accepts(url: string): boolean;
/**
* Load a File from a URL and return it
* @param {string} requestUrl - the url to get
* @param {object} options - additional options
* @return {Promise} a promise to the File
*/
load(requestUrl: string, options: object): Promise<any>;
}
Loading

0 comments on commit 6165d1c

Please sign in to comment.