@accordproject/concerto-util 4.0.0-alpha.2 → 4.0.0-beta.4

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.
Files changed (64) hide show
  1. package/dist/baseexception.d.ts +7 -7
  2. package/dist/baseexception.js +40 -6
  3. package/dist/basefileexception.d.ts +16 -16
  4. package/dist/basefileexception.js +10 -11
  5. package/dist/concerto-util.js +1 -1
  6. package/dist/concerto-util.js.LICENSE.txt +1 -1
  7. package/dist/errorcodes.d.ts +7 -4
  8. package/dist/errorcodes.js +11 -6
  9. package/dist/filedownloader.d.ts +24 -17
  10. package/dist/filedownloader.js +19 -20
  11. package/dist/filewriter.d.ts +28 -25
  12. package/dist/filewriter.js +57 -31
  13. package/dist/identifiers.d.ts +5 -5
  14. package/dist/identifiers.js +10 -11
  15. package/dist/index.d.ts +1 -0
  16. package/dist/index.js +0 -1
  17. package/dist/inmemorywriter.d.ts +11 -6
  18. package/dist/inmemorywriter.js +3 -4
  19. package/dist/label.d.ts +6 -6
  20. package/dist/label.js +7 -9
  21. package/dist/loaders/compositefileloader.d.ts +18 -13
  22. package/dist/loaders/compositefileloader.js +7 -8
  23. package/dist/loaders/defaultfileloader.d.ts +5 -5
  24. package/dist/loaders/defaultfileloader.js +4 -5
  25. package/dist/loaders/fileloader.d.ts +4 -0
  26. package/dist/loaders/fileloader.js +15 -0
  27. package/dist/loaders/githubfileloader.d.ts +22 -3
  28. package/dist/loaders/githubfileloader.js +7 -8
  29. package/dist/loaders/httpfileloader.d.ts +12 -11
  30. package/dist/loaders/httpfileloader.js +8 -7
  31. package/dist/logger.d.ts +35 -55
  32. package/dist/logger.js +24 -64
  33. package/dist/modelwriter.d.ts +12 -4
  34. package/dist/modelwriter.js +38 -10
  35. package/dist/null.d.ts +4 -4
  36. package/dist/null.js +2 -3
  37. package/dist/typedstack.d.ts +15 -14
  38. package/dist/typedstack.js +10 -12
  39. package/dist/warning.d.ts +5 -5
  40. package/dist/warning.js +7 -9
  41. package/dist/writer.d.ts +14 -10
  42. package/dist/writer.js +9 -10
  43. package/package.json +2 -2
  44. package/types/lib/logger.d.ts +2 -2
  45. package/types/lib/null.d.ts +15 -0
  46. package/dist/baseexception.js.map +0 -1
  47. package/dist/basefileexception.js.map +0 -1
  48. package/dist/errorcodes.js.map +0 -1
  49. package/dist/filedownloader.js.map +0 -1
  50. package/dist/filewriter.js.map +0 -1
  51. package/dist/identifiers.js.map +0 -1
  52. package/dist/index.js.map +0 -1
  53. package/dist/inmemorywriter.js.map +0 -1
  54. package/dist/label.js.map +0 -1
  55. package/dist/loaders/compositefileloader.js.map +0 -1
  56. package/dist/loaders/defaultfileloader.js.map +0 -1
  57. package/dist/loaders/githubfileloader.js.map +0 -1
  58. package/dist/loaders/httpfileloader.js.map +0 -1
  59. package/dist/logger.js.map +0 -1
  60. package/dist/modelwriter.js.map +0 -1
  61. package/dist/null.js.map +0 -1
  62. package/dist/typedstack.js.map +0 -1
  63. package/dist/warning.js.map +0 -1
  64. package/dist/writer.js.map +0 -1
@@ -1,4 +1,3 @@
1
- export = BaseException;
2
1
  /**
3
2
  * A base class for all Concerto exceptions
4
3
  * @extends Error
@@ -6,13 +5,14 @@ export = BaseException;
6
5
  * @memberof module:concerto-core
7
6
  */
8
7
  declare class BaseException extends Error {
8
+ component: string;
9
+ errorType: string;
9
10
  /**
10
11
  * Create the BaseException.
11
- * @param {string} message - The exception message.
12
- * @param {string} component - The optional component which throws this error.
13
- * @param {string} errorType - The optional error code regarding the error
12
+ * @param message - The exception message.
13
+ * @param component - The optional component which throws this error.
14
+ * @param errorType - The optional error code regarding the error
14
15
  */
15
- constructor(message: string, component: string, errorType: string);
16
- component: string | undefined;
17
- errorType: string;
16
+ constructor(message: string, component?: string, errorType?: string);
18
17
  }
18
+ export = BaseException;
@@ -12,7 +12,42 @@
12
12
  * limitations under the License.
13
13
  */
14
14
  'use strict';
15
- const ErrorCodes = require('./errorcodes');
15
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
16
+ if (k2 === undefined) k2 = k;
17
+ var desc = Object.getOwnPropertyDescriptor(m, k);
18
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
19
+ desc = { enumerable: true, get: function() { return m[k]; } };
20
+ }
21
+ Object.defineProperty(o, k2, desc);
22
+ }) : (function(o, m, k, k2) {
23
+ if (k2 === undefined) k2 = k;
24
+ o[k2] = m[k];
25
+ }));
26
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
27
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
28
+ }) : function(o, v) {
29
+ o["default"] = v;
30
+ });
31
+ var __importStar = (this && this.__importStar) || (function () {
32
+ var ownKeys = function(o) {
33
+ ownKeys = Object.getOwnPropertyNames || function (o) {
34
+ var ar = [];
35
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
36
+ return ar;
37
+ };
38
+ return ownKeys(o);
39
+ };
40
+ return function (mod) {
41
+ if (mod && mod.__esModule) return mod;
42
+ var result = {};
43
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
44
+ __setModuleDefault(result, mod);
45
+ return result;
46
+ };
47
+ })();
48
+ const ErrorCodes = __importStar(require("./errorcodes"));
49
+ // eslint-disable-next-line @typescript-eslint/no-var-requires
50
+ const packageJson = require('../package.json');
16
51
  /**
17
52
  * A base class for all Concerto exceptions
18
53
  * @extends Error
@@ -22,13 +57,13 @@ const ErrorCodes = require('./errorcodes');
22
57
  class BaseException extends Error {
23
58
  /**
24
59
  * Create the BaseException.
25
- * @param {string} message - The exception message.
26
- * @param {string} component - The optional component which throws this error.
27
- * @param {string} errorType - The optional error code regarding the error
60
+ * @param message - The exception message.
61
+ * @param component - The optional component which throws this error.
62
+ * @param errorType - The optional error code regarding the error
28
63
  */
29
64
  constructor(message, component, errorType) {
30
65
  super(message);
31
- this.component = component || process.env.npm_package_name;
66
+ this.component = component || packageJson.name;
32
67
  this.name = this.constructor.name;
33
68
  this.message = message;
34
69
  this.errorType = errorType || ErrorCodes.DEFAULT_BASE_EXCEPTION;
@@ -38,4 +73,3 @@ class BaseException extends Error {
38
73
  }
39
74
  }
40
75
  module.exports = BaseException;
41
- //# sourceMappingURL=baseexception.js.map
@@ -1,4 +1,4 @@
1
- export = BaseFileException;
1
+ import BaseException = require('./baseexception');
2
2
  /**
3
3
  * Exception throws when a Concerto file is semantically invalid
4
4
  * @extends BaseException
@@ -7,32 +7,32 @@ export = BaseFileException;
7
7
  * @memberof module:concerto-core
8
8
  */
9
9
  declare class BaseFileException extends BaseException {
10
+ fileLocation: string | null;
11
+ shortMessage: string;
12
+ fileName: string | null;
10
13
  /**
11
14
  * Create an BaseFileException
12
- * @param {string} message - the message for the exception
13
- * @param {string} fileLocation - the optional file location associated with the exception
14
- * @param {string} fullMessage - the optional full message text
15
- * @param {string} [fileName] - the file name
16
- * @param {string} [component] - the component which throws this error
15
+ * @param message - the message for the exception
16
+ * @param fileLocation - the optional file location associated with the exception
17
+ * @param fullMessage - the optional full message text
18
+ * @param fileName - the file name
19
+ * @param component - the component which throws this error
17
20
  */
18
- constructor(message: string, fileLocation: string, fullMessage: string, fileName?: string, component?: string);
19
- fileLocation: string;
20
- shortMessage: string;
21
- fileName: string | undefined;
21
+ constructor(message: string, fileLocation?: string | null, fullMessage?: string | null, fileName?: string | null, component?: string);
22
22
  /**
23
23
  * Returns the file location associated with the exception or null
24
- * @return {string} the optional location associated with the exception
24
+ * @return the optional location associated with the exception
25
25
  */
26
- getFileLocation(): string;
26
+ getFileLocation(): string | null;
27
27
  /**
28
28
  * Returns the error message without the location of the error
29
- * @returns {string} the error message
29
+ * @returns the error message
30
30
  */
31
31
  getShortMessage(): string;
32
32
  /**
33
33
  * Returns the fileName for the error
34
- * @returns {string} the file name or null
34
+ * @returns the file name or null
35
35
  */
36
- getFileName(): string;
36
+ getFileName(): string | null;
37
37
  }
38
- import BaseException = require("./baseexception");
38
+ export = BaseFileException;
@@ -12,7 +12,7 @@
12
12
  * limitations under the License.
13
13
  */
14
14
  'use strict';
15
- const BaseException = require('./baseexception');
15
+ const BaseException = require("./baseexception");
16
16
  /**
17
17
  * Exception throws when a Concerto file is semantically invalid
18
18
  * @extends BaseException
@@ -23,13 +23,13 @@ const BaseException = require('./baseexception');
23
23
  class BaseFileException extends BaseException {
24
24
  /**
25
25
  * Create an BaseFileException
26
- * @param {string} message - the message for the exception
27
- * @param {string} fileLocation - the optional file location associated with the exception
28
- * @param {string} fullMessage - the optional full message text
29
- * @param {string} [fileName] - the file name
30
- * @param {string} [component] - the component which throws this error
26
+ * @param message - the message for the exception
27
+ * @param fileLocation - the optional file location associated with the exception
28
+ * @param fullMessage - the optional full message text
29
+ * @param fileName - the file name
30
+ * @param component - the component which throws this error
31
31
  */
32
- constructor(message, fileLocation, fullMessage, fileName, component) {
32
+ constructor(message, fileLocation = null, fullMessage = null, fileName = null, component) {
33
33
  super(fullMessage ? fullMessage : message, component);
34
34
  this.fileLocation = fileLocation;
35
35
  this.shortMessage = message;
@@ -37,25 +37,24 @@ class BaseFileException extends BaseException {
37
37
  }
38
38
  /**
39
39
  * Returns the file location associated with the exception or null
40
- * @return {string} the optional location associated with the exception
40
+ * @return the optional location associated with the exception
41
41
  */
42
42
  getFileLocation() {
43
43
  return this.fileLocation;
44
44
  }
45
45
  /**
46
46
  * Returns the error message without the location of the error
47
- * @returns {string} the error message
47
+ * @returns the error message
48
48
  */
49
49
  getShortMessage() {
50
50
  return this.shortMessage;
51
51
  }
52
52
  /**
53
53
  * Returns the fileName for the error
54
- * @returns {string} the file name or null
54
+ * @returns the file name or null
55
55
  */
56
56
  getFileName() {
57
57
  return this.fileName;
58
58
  }
59
59
  }
60
60
  module.exports = BaseFileException;
61
- //# sourceMappingURL=basefileexception.js.map