@accordproject/concerto-cto 2.0.0-alpha.2 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.js CHANGED
@@ -22,13 +22,20 @@
22
22
  */
23
23
 
24
24
  // Exceptions
25
- module.exports.ParseException = require('./lib/parseexception');
25
+ const ParseException = require('./lib/parseexception');
26
26
 
27
27
  // Parser
28
- module.exports.Parser = require('./lib/parserMain');
28
+ const Parser = require('./lib/parserMain');
29
29
 
30
30
  // Printer
31
- module.exports.Printer = require('./lib/printer');
31
+ const Printer = require('./lib/printer');
32
32
 
33
33
  // External models resolution
34
- module.exports.External = require('./lib/external');
34
+ const External = require('./lib/external');
35
+
36
+ module.exports = {
37
+ ParseException,
38
+ Parser,
39
+ Printer,
40
+ External
41
+ };
package/lib/external.js CHANGED
@@ -16,13 +16,12 @@
16
16
 
17
17
  const path = require('path');
18
18
 
19
- const DefaultFileLoader = require('@accordproject/concerto-util').DefaultFileLoader;
20
- const FileDownloader = require('@accordproject/concerto-util').FileDownloader;
19
+ const { DefaultFileLoader, FileDownloader } = require('@accordproject/concerto-util');
21
20
 
22
21
  const debug = require('debug')('concerto:ModelManager');
23
22
 
24
23
  const Parser = require('./parser');
25
- const MetaModelUtil = require('@accordproject/concerto-metamodel').MetaModelUtil;
24
+ const { MetaModelUtil } = require('@accordproject/concerto-metamodel');
26
25
 
27
26
  /**
28
27
  * Update models with a new model
@@ -14,7 +14,7 @@
14
14
 
15
15
  'use strict';
16
16
 
17
- const BaseFileException = require('@accordproject/concerto-util').BaseFileException;
17
+ const { BaseFileException } = require('@accordproject/concerto-util');
18
18
 
19
19
  /**
20
20
  * Exception throws when a Concerto file is syntactically invalid
package/package.json CHANGED
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "name": "@accordproject/concerto-cto",
3
- "version": "2.0.0-alpha.2",
3
+ "version": "2.0.0",
4
4
  "description": "Parser for Concerto CTO files",
5
5
  "homepage": "https://github.com/accordproject/concerto",
6
6
  "engines": {
7
- "node": ">=12",
7
+ "node": ">=14",
8
8
  "npm": ">=6"
9
9
  },
10
10
  "main": "index.js",
@@ -16,11 +16,12 @@
16
16
  "licchk": "license-check-and-add",
17
17
  "postlicchk": "npm run doc",
18
18
  "doc": "jsdoc --pedantic --recurse -c jsdoc.json",
19
+ "postdoc": "npm run build:types",
19
20
  "test": "nyc mocha --recursive -t 10000",
20
21
  "test:watch": "nyc mocha --watch --recursive -t 10000",
21
22
  "mocha": "mocha --recursive -t 10000",
22
23
  "nyc": "nyc mocha --recursive -t 10000",
23
- "build:types": "npx -p typescript tsc ./lib/*.js index.js --declaration --allowJs --emitDeclarationOnly --outDir types"
24
+ "build:types": "tsc index.js --declaration --allowJs --emitDeclarationOnly --outDir types"
24
25
  },
25
26
  "repository": {
26
27
  "type": "git",
@@ -46,11 +47,12 @@
46
47
  "nyc": "15.1.0",
47
48
  "peggy": "1.2.0",
48
49
  "sinon": "12.0.0",
49
- "sinon-chai": "3.7.0"
50
+ "sinon-chai": "3.7.0",
51
+ "typescript": "4.6.3"
50
52
  },
51
53
  "dependencies": {
52
- "@accordproject/concerto-metamodel": "2.0.0-alpha.2",
53
- "@accordproject/concerto-util": "2.0.0-alpha.2"
54
+ "@accordproject/concerto-metamodel": "2.0.0",
55
+ "@accordproject/concerto-util": "2.0.0"
54
56
  },
55
57
  "browserslist": "> 0.25%, not dead",
56
58
  "license-check-and-add-config": {
package/types/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- export var BaseException: typeof import("./lib/baseexception");
2
- export var BaseFileException: typeof import("./lib/basefileexception");
3
- export var ParseException: typeof import("./lib/parseexception");
4
- export var Parser: typeof import("./lib/parserMain");
5
- export var Printer: typeof import("./lib/printer");
1
+ import ParseException = require("./lib/parseexception");
2
+ import Parser = require("./lib/parserMain");
3
+ import Printer = require("./lib/printer");
4
+ import External = require("./lib/external");
5
+ export { ParseException, Parser, Printer, External };
@@ -1,7 +1,11 @@
1
1
  /**
2
- * Create decorator argument string from a metamodel
3
- * @param {string} cto - the Concerto string
4
- * @param {string} [fileName] - an optional file name
5
- * @return {object} the string for the decorator argument
2
+ * Downloads all ModelFiles that are external dependencies and adds or
3
+ * updates them in this ModelManager.
4
+ * @param {*} models - the AST for all the known models
5
+ * @param {Object} [options] - Options object passed to ModelFileLoaders
6
+ * @param {FileDownloader} [fileDownloader] - an optional FileDownloader
7
+ * @throws {IllegalModelException} if the models fail validation
8
+ * @return {Promise} a promise when the download and update operation is completed.
6
9
  */
7
- export function parse(cto: string, fileName?: string): object;
10
+ export function resolveExternal(models: any, options?: any, fileDownloader?: FileDownloader): Promise<any>;
11
+ import { FileDownloader } from "@accordproject/concerto-util";
@@ -18,4 +18,4 @@ declare class ParseException extends BaseFileException {
18
18
  */
19
19
  constructor(message: string, fileLocation?: string, fileName?: string, fullMessageOverride?: string, component?: string);
20
20
  }
21
- import BaseFileException = require("./basefileexception");
21
+ import { BaseFileException } from "@accordproject/concerto-util";
@@ -11,13 +11,3 @@ export function parse(cto: string, fileName?: string): object;
11
11
  * @return {*} the AST / metamodel
12
12
  */
13
13
  export function parseModels(files: string[]): any;
14
- /**
15
- * Downloads all ModelFiles that are external dependencies and adds or
16
- * updates them in this ModelManager.
17
- * @param {*} models - the AST for all the known models
18
- * @param {Object} [options] - Options object passed to ModelFileLoaders
19
- * @param {FileDownloader} [fileDownloader] - an optional FileDownloader
20
- * @throws {IllegalModelException} if the models fail validation
21
- * @return {Promise} a promise when the download and update operation is completed.
22
- */
23
- export function resolve(models: any, options?: any, fileDownloader?: typeof import("@accordproject/concerto-util/types/lib/filedownloader")): Promise<any>;