@accordproject/concerto-util 4.2.0 → 5.0.0-beta.2

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 (193) hide show
  1. package/dist/baseexception.d.ts +2 -1
  2. package/dist/baseexception.js +5 -2
  3. package/dist/basefileexception.d.ts +3 -2
  4. package/dist/basefileexception.js +10 -4
  5. package/dist/esm/baseexception.mjs +13 -0
  6. package/dist/esm/baseexception.mjs.map +7 -0
  7. package/dist/esm/basefileexception.mjs +14 -0
  8. package/dist/esm/basefileexception.mjs.map +7 -0
  9. package/dist/esm/chunk-3RJ6JXLX.mjs +29 -0
  10. package/dist/esm/chunk-3RJ6JXLX.mjs.map +7 -0
  11. package/dist/esm/chunk-3U4T7O4P.mjs +41 -0
  12. package/dist/esm/chunk-3U4T7O4P.mjs.map +7 -0
  13. package/dist/esm/chunk-D4MNWWBB.mjs +43 -0
  14. package/dist/esm/chunk-D4MNWWBB.mjs.map +7 -0
  15. package/dist/esm/chunk-DTVQ7VXD.mjs +30 -0
  16. package/dist/esm/chunk-DTVQ7VXD.mjs.map +7 -0
  17. package/dist/esm/chunk-FHUVVHGR.mjs +48 -0
  18. package/dist/esm/chunk-FHUVVHGR.mjs.map +7 -0
  19. package/dist/esm/chunk-FK2LDKS6.mjs +36 -0
  20. package/dist/esm/chunk-FK2LDKS6.mjs.map +7 -0
  21. package/dist/esm/chunk-G6IDW2UD.mjs +183 -0
  22. package/dist/esm/chunk-G6IDW2UD.mjs.map +7 -0
  23. package/dist/esm/chunk-GOLEPEBI.mjs +56 -0
  24. package/dist/esm/chunk-GOLEPEBI.mjs.map +7 -0
  25. package/dist/esm/chunk-I33X6SGY.mjs +70 -0
  26. package/dist/esm/chunk-I33X6SGY.mjs.map +7 -0
  27. package/dist/esm/chunk-K4OOJFK5.mjs +93 -0
  28. package/dist/esm/chunk-K4OOJFK5.mjs.map +7 -0
  29. package/dist/esm/chunk-LPNGJFU2.mjs +22 -0
  30. package/dist/esm/chunk-LPNGJFU2.mjs.map +7 -0
  31. package/dist/esm/chunk-PBL5N3A2.mjs +33 -0
  32. package/dist/esm/chunk-PBL5N3A2.mjs.map +7 -0
  33. package/dist/esm/chunk-PMP2SMHG.mjs +17 -0
  34. package/dist/esm/chunk-PMP2SMHG.mjs.map +7 -0
  35. package/dist/esm/chunk-Q6G4HQJ7.mjs +151 -0
  36. package/dist/esm/chunk-Q6G4HQJ7.mjs.map +7 -0
  37. package/dist/esm/chunk-RBUQLLXW.mjs +51 -0
  38. package/dist/esm/chunk-RBUQLLXW.mjs.map +7 -0
  39. package/dist/esm/chunk-T6ZBQYEB.mjs +97 -0
  40. package/dist/esm/chunk-T6ZBQYEB.mjs.map +7 -0
  41. package/dist/esm/chunk-TP3CT6S4.mjs +35 -0
  42. package/dist/esm/chunk-TP3CT6S4.mjs.map +7 -0
  43. package/dist/esm/chunk-WPVG6LP3.mjs +63 -0
  44. package/dist/esm/chunk-WPVG6LP3.mjs.map +7 -0
  45. package/dist/esm/chunk-YQVUNOO6.mjs +93 -0
  46. package/dist/esm/chunk-YQVUNOO6.mjs.map +7 -0
  47. package/dist/esm/errorcodes.mjs +22 -0
  48. package/dist/esm/errorcodes.mjs.map +7 -0
  49. package/dist/esm/filedownloader.mjs +12 -0
  50. package/dist/esm/filedownloader.mjs.map +7 -0
  51. package/dist/esm/filewriter.mjs +13 -0
  52. package/dist/esm/filewriter.mjs.map +7 -0
  53. package/dist/esm/identifiers.mjs +12 -0
  54. package/dist/esm/identifiers.mjs.map +7 -0
  55. package/dist/esm/index.mjs +78 -0
  56. package/dist/esm/index.mjs.map +7 -0
  57. package/dist/esm/inmemorywriter.mjs +13 -0
  58. package/dist/esm/inmemorywriter.mjs.map +7 -0
  59. package/dist/esm/label.mjs +12 -0
  60. package/dist/esm/label.mjs.map +7 -0
  61. package/dist/esm/loaders/compositefileloader.mjs +12 -0
  62. package/dist/esm/loaders/compositefileloader.mjs.map +7 -0
  63. package/dist/esm/loaders/defaultfileloader.mjs +15 -0
  64. package/dist/esm/loaders/defaultfileloader.mjs.map +7 -0
  65. package/dist/esm/loaders/fileloader.mjs +3 -0
  66. package/dist/esm/loaders/fileloader.mjs.map +7 -0
  67. package/dist/esm/loaders/githubfileloader.mjs +13 -0
  68. package/dist/esm/loaders/githubfileloader.mjs.map +7 -0
  69. package/dist/esm/loaders/httpfileloader.mjs +12 -0
  70. package/dist/esm/loaders/httpfileloader.mjs.map +7 -0
  71. package/dist/esm/logger.mjs +12 -0
  72. package/dist/esm/logger.mjs.map +7 -0
  73. package/dist/esm/modelwriter.mjs +10 -0
  74. package/dist/esm/modelwriter.mjs.map +7 -0
  75. package/dist/esm/null.mjs +12 -0
  76. package/dist/esm/null.mjs.map +7 -0
  77. package/dist/esm/typedstack.mjs +12 -0
  78. package/dist/esm/typedstack.mjs.map +7 -0
  79. package/dist/esm/warning.mjs +10 -0
  80. package/dist/esm/warning.mjs.map +7 -0
  81. package/dist/esm/writer.mjs +12 -0
  82. package/dist/esm/writer.mjs.map +7 -0
  83. package/dist/esm-browser/baseexception.mjs +11 -0
  84. package/dist/esm-browser/baseexception.mjs.map +7 -0
  85. package/dist/esm-browser/basefileexception.mjs +12 -0
  86. package/dist/esm-browser/basefileexception.mjs.map +7 -0
  87. package/dist/esm-browser/chunk-3XGAUT4O.mjs +100 -0
  88. package/dist/esm-browser/chunk-3XGAUT4O.mjs.map +7 -0
  89. package/dist/esm-browser/chunk-4X5DBZDM.mjs +24 -0
  90. package/dist/esm-browser/chunk-4X5DBZDM.mjs.map +7 -0
  91. package/dist/esm-browser/chunk-6SOOHVQB.mjs +65 -0
  92. package/dist/esm-browser/chunk-6SOOHVQB.mjs.map +7 -0
  93. package/dist/esm-browser/chunk-7DYPHXUR.mjs +50 -0
  94. package/dist/esm-browser/chunk-7DYPHXUR.mjs.map +7 -0
  95. package/dist/esm-browser/chunk-7LYWQ57N.mjs +461 -0
  96. package/dist/esm-browser/chunk-7LYWQ57N.mjs.map +7 -0
  97. package/dist/esm-browser/chunk-BDMF4RRF.mjs +72 -0
  98. package/dist/esm-browser/chunk-BDMF4RRF.mjs.map +7 -0
  99. package/dist/esm-browser/chunk-BSBOEFWN.mjs +57 -0
  100. package/dist/esm-browser/chunk-BSBOEFWN.mjs.map +7 -0
  101. package/dist/esm-browser/chunk-DOL2YKDZ.mjs +26 -0
  102. package/dist/esm-browser/chunk-DOL2YKDZ.mjs.map +7 -0
  103. package/dist/esm-browser/chunk-EGOFDABS.mjs +62 -0
  104. package/dist/esm-browser/chunk-EGOFDABS.mjs.map +7 -0
  105. package/dist/esm-browser/chunk-LZTTRWN3.mjs +153 -0
  106. package/dist/esm-browser/chunk-LZTTRWN3.mjs.map +7 -0
  107. package/dist/esm-browser/chunk-MCUSZIV7.mjs +41 -0
  108. package/dist/esm-browser/chunk-MCUSZIV7.mjs.map +7 -0
  109. package/dist/esm-browser/chunk-N42BHUZ6.mjs +35 -0
  110. package/dist/esm-browser/chunk-N42BHUZ6.mjs.map +7 -0
  111. package/dist/esm-browser/chunk-NAP47VIV.mjs +36 -0
  112. package/dist/esm-browser/chunk-NAP47VIV.mjs.map +7 -0
  113. package/dist/esm-browser/chunk-NQ5PDAAD.mjs +95 -0
  114. package/dist/esm-browser/chunk-NQ5PDAAD.mjs.map +7 -0
  115. package/dist/esm-browser/chunk-NSJTBLWA.mjs +71 -0
  116. package/dist/esm-browser/chunk-NSJTBLWA.mjs.map +7 -0
  117. package/dist/esm-browser/chunk-R6CSKES3.mjs +183 -0
  118. package/dist/esm-browser/chunk-R6CSKES3.mjs.map +7 -0
  119. package/dist/esm-browser/chunk-S52XDDAF.mjs +30 -0
  120. package/dist/esm-browser/chunk-S52XDDAF.mjs.map +7 -0
  121. package/dist/esm-browser/chunk-SU6SG5PJ.mjs +45 -0
  122. package/dist/esm-browser/chunk-SU6SG5PJ.mjs.map +7 -0
  123. package/dist/esm-browser/chunk-WCGRUR5U.mjs +30 -0
  124. package/dist/esm-browser/chunk-WCGRUR5U.mjs.map +7 -0
  125. package/dist/esm-browser/chunk-YJQCJTA7.mjs +53 -0
  126. package/dist/esm-browser/chunk-YJQCJTA7.mjs.map +7 -0
  127. package/dist/esm-browser/chunk-YURYZDD2.mjs +453 -0
  128. package/dist/esm-browser/chunk-YURYZDD2.mjs.map +7 -0
  129. package/dist/esm-browser/errorcodes.mjs +20 -0
  130. package/dist/esm-browser/errorcodes.mjs.map +7 -0
  131. package/dist/esm-browser/filedownloader.mjs +11 -0
  132. package/dist/esm-browser/filedownloader.mjs.map +7 -0
  133. package/dist/esm-browser/filewriter.mjs +12 -0
  134. package/dist/esm-browser/filewriter.mjs.map +7 -0
  135. package/dist/esm-browser/identifiers.mjs +10 -0
  136. package/dist/esm-browser/identifiers.mjs.map +7 -0
  137. package/dist/esm-browser/index.mjs +83 -0
  138. package/dist/esm-browser/index.mjs.map +7 -0
  139. package/dist/esm-browser/inmemorywriter.mjs +11 -0
  140. package/dist/esm-browser/inmemorywriter.mjs.map +7 -0
  141. package/dist/esm-browser/label.mjs +10 -0
  142. package/dist/esm-browser/label.mjs.map +7 -0
  143. package/dist/esm-browser/loaders/compositefileloader.mjs +10 -0
  144. package/dist/esm-browser/loaders/compositefileloader.mjs.map +7 -0
  145. package/dist/esm-browser/loaders/defaultfileloader.mjs +14 -0
  146. package/dist/esm-browser/loaders/defaultfileloader.mjs.map +7 -0
  147. package/dist/esm-browser/loaders/fileloader.mjs +7 -0
  148. package/dist/esm-browser/loaders/fileloader.mjs.map +7 -0
  149. package/dist/esm-browser/loaders/githubfileloader.mjs +12 -0
  150. package/dist/esm-browser/loaders/githubfileloader.mjs.map +7 -0
  151. package/dist/esm-browser/loaders/httpfileloader.mjs +11 -0
  152. package/dist/esm-browser/loaders/httpfileloader.mjs.map +7 -0
  153. package/dist/esm-browser/logger.mjs +10 -0
  154. package/dist/esm-browser/logger.mjs.map +7 -0
  155. package/dist/esm-browser/modelwriter.mjs +9 -0
  156. package/dist/esm-browser/modelwriter.mjs.map +7 -0
  157. package/dist/esm-browser/null.mjs +10 -0
  158. package/dist/esm-browser/null.mjs.map +7 -0
  159. package/dist/esm-browser/typedstack.mjs +10 -0
  160. package/dist/esm-browser/typedstack.mjs.map +7 -0
  161. package/dist/esm-browser/warning.mjs +8 -0
  162. package/dist/esm-browser/warning.mjs.map +7 -0
  163. package/dist/esm-browser/writer.mjs +10 -0
  164. package/dist/esm-browser/writer.mjs.map +7 -0
  165. package/dist/filedownloader.d.ts +14 -6
  166. package/dist/filedownloader.js +32 -12
  167. package/dist/filewriter.d.ts +3 -2
  168. package/dist/filewriter.js +10 -4
  169. package/dist/identifiers.js +4 -2
  170. package/dist/index.d.ts +18 -17
  171. package/dist/index.js +34 -31
  172. package/dist/inmemorywriter.d.ts +3 -2
  173. package/dist/inmemorywriter.js +10 -4
  174. package/dist/loaders/compositefileloader.d.ts +2 -1
  175. package/dist/loaders/compositefileloader.js +5 -2
  176. package/dist/loaders/defaultfileloader.d.ts +3 -2
  177. package/dist/loaders/defaultfileloader.js +14 -8
  178. package/dist/loaders/githubfileloader.d.ts +3 -2
  179. package/dist/loaders/githubfileloader.js +10 -4
  180. package/dist/loaders/httpfileloader.d.ts +2 -1
  181. package/dist/loaders/httpfileloader.js +10 -3
  182. package/dist/logger.d.ts +2 -1
  183. package/dist/logger.js +5 -2
  184. package/dist/modelwriter.js +6 -4
  185. package/dist/null.d.ts +3 -2
  186. package/dist/null.js +5 -2
  187. package/dist/typedstack.d.ts +2 -1
  188. package/dist/typedstack.js +5 -2
  189. package/dist/writer.d.ts +2 -1
  190. package/dist/writer.js +5 -2
  191. package/package.json +16 -8
  192. package/dist/concerto-util.js +0 -2
  193. package/dist/concerto-util.js.LICENSE.txt +0 -19
@@ -0,0 +1,56 @@
1
+ import { createRequire as __createRequire } from "module";
2
+ const require = __createRequire(import.meta.url);
3
+
4
+ // src/loaders/httpfileloader.ts
5
+ import createDebug from "debug";
6
+ var debug = createDebug("concerto:HTTPFileLoader");
7
+ var HTTPFileLoader = class {
8
+ /**
9
+ * Create the HTTPFileLoader.
10
+ * @param processFile - a function to apply to the content of the file
11
+ */
12
+ constructor(processFile) {
13
+ this.processFile = processFile;
14
+ }
15
+ /**
16
+ * Returns true if this ModelLoader can process the URL
17
+ * @param url - the URL
18
+ * @return true if this ModelLoader accepts the URL
19
+ * @abstract
20
+ */
21
+ accepts(url) {
22
+ return url.startsWith("http://") || url.startsWith("https://");
23
+ }
24
+ /**
25
+ * Load a text File from a URL and return it
26
+ * @param requestUrl - the url to get
27
+ * @param options - additional options
28
+ * @return a promise to the File
29
+ */
30
+ async load(requestUrl, options) {
31
+ if (!options) {
32
+ options = {
33
+ method: "GET",
34
+ headers: {
35
+ "Content-Type": "text/plain"
36
+ }
37
+ };
38
+ }
39
+ debug("loading", requestUrl);
40
+ const response = await fetch(requestUrl, options);
41
+ if (!response.ok) {
42
+ throw new Error(`HTTP request failed with status: ${response.status}`);
43
+ }
44
+ const text = await response.text();
45
+ const url = new URL(requestUrl);
46
+ const name = "@" + (url.host + url.pathname).replace(/\//g, ".");
47
+ return this.processFile(name, text);
48
+ }
49
+ };
50
+ var httpfileloader_default = HTTPFileLoader;
51
+
52
+ export {
53
+ HTTPFileLoader,
54
+ httpfileloader_default
55
+ };
56
+ //# sourceMappingURL=chunk-GOLEPEBI.mjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/loaders/httpfileloader.ts"],
4
+ "sourcesContent": ["/*\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type { FileLoader } from './fileloader';\nimport createDebug from 'debug';\n\nconst debug = createDebug('concerto:HTTPFileLoader');\n\n// Ensure fetch is recognized if not in global types\ndeclare const fetch: (input: string | URL, init?: RequestInit) => Promise<{ ok: boolean; status: number; text(): Promise<string> }>;\n\n/**\n * Loads Files from an HTTP(S) URL using fetch.\n * @class\n * @private\n * @memberof module:concerto-util\n */\nclass HTTPFileLoader<T> implements FileLoader<T> {\n public processFile: (name: string, text: string) => T;\n\n /**\n * Create the HTTPFileLoader.\n * @param processFile - a function to apply to the content of the file\n */\n constructor(processFile: (name: string, text: string) => T) {\n this.processFile = processFile;\n }\n\n /**\n * Returns true if this ModelLoader can process the URL\n * @param url - the URL\n * @return true if this ModelLoader accepts the URL\n * @abstract\n */\n accepts(url: string): boolean {\n return url.startsWith('http://') || url.startsWith('https://');\n }\n\n /**\n * Load a text File from a URL and return it\n * @param requestUrl - the url to get\n * @param options - additional options\n * @return a promise to the File\n */\n async load(requestUrl: string, options?: RequestInit): Promise<T> {\n if (!options) {\n options = {\n method: 'GET',\n headers: {\n 'Content-Type': 'text/plain',\n }\n };\n }\n\n debug('loading', requestUrl);\n const response = await fetch(requestUrl, options);\n if (!response.ok) {\n throw new Error(`HTTP request failed with status: ${response.status}`);\n }\n const text = await response.text();\n const url = new URL(requestUrl);\n // external Files have a name that starts with '@'\n // (so that they are identified as external when an archive is read back in)\n const name = '@' + (url.host + url.pathname).replace(/\\//g, '.');\n return this.processFile(name, text);\n }\n}\n\nexport { HTTPFileLoader };\nexport default HTTPFileLoader;\n"],
5
+ "mappings": ";;;;AAeA,OAAO,iBAAiB;AAExB,IAAM,QAAQ,YAAY,yBAAyB;AAWnD,IAAM,iBAAN,MAAiD;AAAA;AAAA;AAAA;AAAA;AAAA,EAO7C,YAAY,aAAgD;AACxD,SAAK,cAAc;AAAA,EACvB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQA,QAAQ,KAAsB;AAC1B,WAAO,IAAI,WAAW,SAAS,KAAK,IAAI,WAAW,UAAU;AAAA,EACjE;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQA,MAAM,KAAK,YAAoB,SAAmC;AAC9D,QAAI,CAAC,SAAS;AACV,gBAAU;AAAA,QACN,QAAQ;AAAA,QACR,SAAS;AAAA,UACL,gBAAgB;AAAA,QACpB;AAAA,MACJ;AAAA,IACJ;AAEA,UAAM,WAAW,UAAU;AAC3B,UAAM,WAAW,MAAM,MAAM,YAAY,OAAO;AAChD,QAAI,CAAC,SAAS,IAAI;AACd,YAAM,IAAI,MAAM,oCAAoC,SAAS,MAAM,EAAE;AAAA,IACzE;AACA,UAAM,OAAO,MAAM,SAAS,KAAK;AACjC,UAAM,MAAM,IAAI,IAAI,UAAU;AAG9B,UAAM,OAAO,OAAO,IAAI,OAAO,IAAI,UAAU,QAAQ,OAAO,GAAG;AAC/D,WAAO,KAAK,YAAY,MAAM,IAAI;AAAA,EACtC;AACJ;AAGA,IAAO,yBAAQ;",
6
+ "names": []
7
+ }
@@ -0,0 +1,70 @@
1
+ import { createRequire as __createRequire } from "module";
2
+ const require = __createRequire(import.meta.url);
3
+
4
+ // src/loaders/compositefileloader.ts
5
+ var CompositeFileLoader = class {
6
+ /**
7
+ * Create the CompositeFileLoader. Used to delegate to a set of FileLoaders.
8
+ */
9
+ constructor() {
10
+ this.fileLoaders = [];
11
+ }
12
+ /**
13
+ * Adds a FileLoader implemenetation to the FileLoader
14
+ * @param fileLoader - The script to add to the ScriptManager
15
+ */
16
+ addFileLoader(fileLoader) {
17
+ this.fileLoaders.push(fileLoader);
18
+ }
19
+ /**
20
+ * Get the array of FileLoader instances
21
+ * @return The FileLoader registered
22
+ * @private
23
+ */
24
+ getFileLoaders() {
25
+ return this.fileLoaders;
26
+ }
27
+ /**
28
+ * Remove all registered FileLoaders
29
+ */
30
+ clearFileLoaders() {
31
+ this.fileLoaders = [];
32
+ }
33
+ /**
34
+ * Returns true if this ModelLoader can process the URL
35
+ * @param url - the URL
36
+ * @return true if this ModelLoader accepts the URL
37
+ * @abstract
38
+ */
39
+ accepts(url) {
40
+ for (let n = 0; n < this.fileLoaders.length; n++) {
41
+ const ml = this.fileLoaders[n];
42
+ if (ml.accepts(url)) {
43
+ return true;
44
+ }
45
+ }
46
+ return false;
47
+ }
48
+ /**
49
+ * Load a File from a URL and return it
50
+ * @param url - the url to get
51
+ * @param options - additional options
52
+ * @return a promise to the File
53
+ */
54
+ load(url, options) {
55
+ for (let n = 0; n < this.fileLoaders.length; n++) {
56
+ const ml = this.fileLoaders[n];
57
+ if (ml.accepts(url)) {
58
+ return ml.load(url, options);
59
+ }
60
+ }
61
+ throw new Error("Failed to find a model file loader that can handle: " + url);
62
+ }
63
+ };
64
+ var compositefileloader_default = CompositeFileLoader;
65
+
66
+ export {
67
+ CompositeFileLoader,
68
+ compositefileloader_default
69
+ };
70
+ //# sourceMappingURL=chunk-I33X6SGY.mjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/loaders/compositefileloader.ts"],
4
+ "sourcesContent": ["/*\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type { FileLoader } from './fileloader';\n\n/**\n * <p>\n * Manages a set of model file loaders, delegating to the first model file\n * loader that accepts a URL.\n * </p>\n * @private\n * @class\n * @memberof module:concerto-util\n */\nclass CompositeFileLoader<T = unknown> {\n public fileLoaders: Array<FileLoader<T>>;\n\n /**\n * Create the CompositeFileLoader. Used to delegate to a set of FileLoaders.\n */\n constructor() {\n this.fileLoaders = [];\n }\n\n /**\n * Adds a FileLoader implemenetation to the FileLoader\n * @param fileLoader - The script to add to the ScriptManager\n */\n addFileLoader(fileLoader: FileLoader<T>): void {\n this.fileLoaders.push(fileLoader);\n }\n\n /**\n * Get the array of FileLoader instances\n * @return The FileLoader registered\n * @private\n */\n getFileLoaders(): Array<FileLoader<T>> {\n return this.fileLoaders;\n }\n\n /**\n * Remove all registered FileLoaders\n */\n clearFileLoaders(): void {\n this.fileLoaders = [];\n }\n\n /**\n * Returns true if this ModelLoader can process the URL\n * @param url - the URL\n * @return true if this ModelLoader accepts the URL\n * @abstract\n */\n accepts(url: string): boolean {\n for (let n = 0; n < this.fileLoaders.length; n++) {\n const ml = this.fileLoaders[n];\n\n if (ml.accepts(url)) {\n return true;\n }\n }\n\n return false;\n }\n\n /**\n * Load a File from a URL and return it\n * @param url - the url to get\n * @param options - additional options\n * @return a promise to the File\n */\n load(url: string, options?: RequestInit): Promise<T> {\n for (let n = 0; n < this.fileLoaders.length; n++) {\n const ml = this.fileLoaders[n];\n\n if (ml.accepts(url)) {\n return ml.load(url, options);\n }\n }\n\n throw new Error('Failed to find a model file loader that can handle: ' + url);\n }\n}\n\nexport { CompositeFileLoader };\nexport default CompositeFileLoader;\n"],
5
+ "mappings": ";;;;AAyBA,IAAM,sBAAN,MAAuC;AAAA;AAAA;AAAA;AAAA,EAMnC,cAAc;AACV,SAAK,cAAc,CAAC;AAAA,EACxB;AAAA;AAAA;AAAA;AAAA;AAAA,EAMA,cAAc,YAAiC;AAC3C,SAAK,YAAY,KAAK,UAAU;AAAA,EACpC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,iBAAuC;AACnC,WAAO,KAAK;AAAA,EAChB;AAAA;AAAA;AAAA;AAAA,EAKA,mBAAyB;AACrB,SAAK,cAAc,CAAC;AAAA,EACxB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQA,QAAQ,KAAsB;AAC1B,aAAS,IAAI,GAAG,IAAI,KAAK,YAAY,QAAQ,KAAK;AAC9C,YAAM,KAAK,KAAK,YAAY,CAAC;AAE7B,UAAI,GAAG,QAAQ,GAAG,GAAG;AACjB,eAAO;AAAA,MACX;AAAA,IACJ;AAEA,WAAO;AAAA,EACX;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQA,KAAK,KAAa,SAAmC;AACjD,aAAS,IAAI,GAAG,IAAI,KAAK,YAAY,QAAQ,KAAK;AAC9C,YAAM,KAAK,KAAK,YAAY,CAAC;AAE7B,UAAI,GAAG,QAAQ,GAAG,GAAG;AACjB,eAAO,GAAG,KAAK,KAAK,OAAO;AAAA,MAC/B;AAAA,IACJ;AAEA,UAAM,IAAI,MAAM,yDAAyD,GAAG;AAAA,EAChF;AACJ;AAGA,IAAO,8BAAQ;",
6
+ "names": []
7
+ }
@@ -0,0 +1,93 @@
1
+ import { createRequire as __createRequire } from "module";
2
+ const require = __createRequire(import.meta.url);
3
+
4
+ // src/writer.ts
5
+ var Writer = class {
6
+ /**
7
+ * Create a Writer.
8
+ */
9
+ constructor() {
10
+ this.beforeBuffer = "";
11
+ this.buffer = "";
12
+ this.linesWritten = 0;
13
+ }
14
+ /**
15
+ * Writes text to the start of the buffer
16
+ * @param tabs - the number of tabs to use
17
+ * @param text - the text to write
18
+ */
19
+ writeBeforeLine(tabs, text) {
20
+ for (let n = 0; n < tabs; n++) {
21
+ this.beforeBuffer += " ";
22
+ }
23
+ this.beforeBuffer += text;
24
+ this.beforeBuffer += "\n";
25
+ this.linesWritten++;
26
+ }
27
+ /**
28
+ * Append text to the buffer
29
+ * @param tabs - the number of tabs to use
30
+ * @param text - the text to write
31
+ */
32
+ writeLine(tabs, text) {
33
+ for (let n = 0; n < tabs; n++) {
34
+ this.write(" ");
35
+ }
36
+ this.write(text);
37
+ this.write("\n");
38
+ this.linesWritten++;
39
+ }
40
+ /**
41
+ * Returns the number of lines that have been written to the buffer.
42
+ * @return the number of lines written to the buffer.
43
+ */
44
+ getLineCount() {
45
+ return this.linesWritten;
46
+ }
47
+ /**
48
+ * Append text to the buffer, prepending tabs
49
+ * @param tabs - the number of tabs to use
50
+ * @param text - the text to write
51
+ */
52
+ writeIndented(tabs, text) {
53
+ for (let n = 0; n < tabs; n++) {
54
+ this.write(" ");
55
+ }
56
+ this.write(text);
57
+ }
58
+ /**
59
+ * Append text to the buffer (no automatic newline). The
60
+ * text may contain newline, and these will increment the linesWritten
61
+ * counter.
62
+ * @param msg - the text to write
63
+ */
64
+ write(msg) {
65
+ if (typeof msg !== "string") {
66
+ throw new Error("Can only append strings. Argument " + msg + " has type " + typeof msg);
67
+ }
68
+ this.buffer += msg;
69
+ this.linesWritten += msg.split(/\r\n|\r|\n/).length;
70
+ }
71
+ /**
72
+ * Returns the text that has been buffered in this Writer.
73
+ * @return the buffered text.
74
+ */
75
+ getBuffer() {
76
+ return this.beforeBuffer + this.buffer;
77
+ }
78
+ /**
79
+ * Empties the underyling buffer and resets the line count.
80
+ */
81
+ clearBuffer() {
82
+ this.beforeBuffer = "";
83
+ this.buffer = "";
84
+ this.linesWritten = 0;
85
+ }
86
+ };
87
+ var writer_default = Writer;
88
+
89
+ export {
90
+ Writer,
91
+ writer_default
92
+ };
93
+ //# sourceMappingURL=chunk-K4OOJFK5.mjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/writer.ts"],
4
+ "sourcesContent": ["/*\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/**\n * Writer buffers text to be written in memory. It handles simple\n * indentation and tracks the number of lines written.\n * @private\n * @class\n * @memberof module:concerto-util\n */\nclass Writer {\n public beforeBuffer: string;\n public buffer: string;\n public linesWritten: number;\n\n /**\n * Create a Writer.\n */\n constructor() {\n this.beforeBuffer = '';\n this.buffer = '';\n this.linesWritten = 0;\n }\n\n /**\n * Writes text to the start of the buffer\n * @param tabs - the number of tabs to use\n * @param text - the text to write\n */\n writeBeforeLine(tabs: number, text: string): void {\n for(let n=0; n < tabs; n++) {\n this.beforeBuffer += ' ';\n }\n this.beforeBuffer += text;\n this.beforeBuffer += '\\n';\n this.linesWritten++;\n }\n\n /**\n * Append text to the buffer\n * @param tabs - the number of tabs to use\n * @param text - the text to write\n */\n writeLine(tabs: number, text: string): void {\n for(let n=0; n < tabs; n++) {\n this.write(' ');\n }\n this.write(text);\n this.write('\\n');\n this.linesWritten++;\n }\n\n /**\n * Returns the number of lines that have been written to the buffer.\n * @return the number of lines written to the buffer.\n */\n getLineCount(): number {\n return this.linesWritten;\n }\n\n\n /**\n * Append text to the buffer, prepending tabs\n * @param tabs - the number of tabs to use\n * @param text - the text to write\n */\n writeIndented(tabs: number, text: string): void {\n for(let n=0; n < tabs; n++) {\n this.write(' ');\n }\n this.write(text);\n }\n\n /**\n * Append text to the buffer (no automatic newline). The\n * text may contain newline, and these will increment the linesWritten\n * counter.\n * @param msg - the text to write\n */\n write(msg: string): void {\n if(typeof msg !== 'string' ) {\n throw new Error('Can only append strings. Argument ' + msg + ' has type ' + typeof msg);\n }\n\n this.buffer += msg;\n this.linesWritten += msg.split(/\\r\\n|\\r|\\n/).length;\n }\n\n /**\n * Returns the text that has been buffered in this Writer.\n * @return the buffered text.\n */\n getBuffer(): string {\n return this.beforeBuffer + this.buffer;\n }\n\n /**\n * Empties the underyling buffer and resets the line count.\n */\n clearBuffer(): void {\n this.beforeBuffer = '';\n this.buffer = '';\n this.linesWritten = 0;\n }\n}\n\nexport { Writer };\nexport default Writer;\n"],
5
+ "mappings": ";;;;AAqBA,IAAM,SAAN,MAAa;AAAA;AAAA;AAAA;AAAA,EAQT,cAAc;AACV,SAAK,eAAe;AACpB,SAAK,SAAS;AACd,SAAK,eAAe;AAAA,EACxB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,gBAAgB,MAAc,MAAoB;AAC9C,aAAQ,IAAE,GAAG,IAAI,MAAM,KAAK;AACxB,WAAK,gBAAgB;AAAA,IACzB;AACA,SAAK,gBAAgB;AACrB,SAAK,gBAAgB;AACrB,SAAK;AAAA,EACT;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,UAAU,MAAc,MAAoB;AACxC,aAAQ,IAAE,GAAG,IAAI,MAAM,KAAK;AACxB,WAAK,MAAM,KAAK;AAAA,IACpB;AACA,SAAK,MAAM,IAAI;AACf,SAAK,MAAM,IAAI;AACf,SAAK;AAAA,EACT;AAAA;AAAA;AAAA;AAAA;AAAA,EAMA,eAAuB;AACnB,WAAO,KAAK;AAAA,EAChB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQA,cAAc,MAAc,MAAoB;AAC5C,aAAQ,IAAE,GAAG,IAAI,MAAM,KAAK;AACxB,WAAK,MAAM,KAAK;AAAA,IACpB;AACA,SAAK,MAAM,IAAI;AAAA,EACnB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQA,MAAM,KAAmB;AACrB,QAAG,OAAO,QAAQ,UAAW;AACzB,YAAM,IAAI,MAAM,uCAAuC,MAAM,eAAe,OAAO,GAAG;AAAA,IAC1F;AAEA,SAAK,UAAU;AACf,SAAK,gBAAgB,IAAI,MAAM,YAAY,EAAE;AAAA,EACjD;AAAA;AAAA;AAAA;AAAA;AAAA,EAMA,YAAoB;AAChB,WAAO,KAAK,eAAe,KAAK;AAAA,EACpC;AAAA;AAAA;AAAA;AAAA,EAKA,cAAoB;AAChB,SAAK,eAAe;AACpB,SAAK,SAAS;AACd,SAAK,eAAe;AAAA,EACxB;AACJ;AAGA,IAAO,iBAAQ;",
6
+ "names": []
7
+ }
@@ -0,0 +1,22 @@
1
+ import { createRequire as __createRequire } from "module";
2
+ const require = __createRequire(import.meta.url);
3
+
4
+ // src/null.ts
5
+ var NullUtil = class {
6
+ /**
7
+ * Returns true if the typeof the object === 'undefined' or
8
+ * the object === null.
9
+ * @param obj - the object to be tested
10
+ * @returns true if the object is null or undefined
11
+ */
12
+ static isNull(obj) {
13
+ return typeof obj === "undefined" || obj === null;
14
+ }
15
+ };
16
+ var null_default = NullUtil;
17
+
18
+ export {
19
+ NullUtil,
20
+ null_default
21
+ };
22
+ //# sourceMappingURL=chunk-LPNGJFU2.mjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/null.ts"],
4
+ "sourcesContent": ["/*\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/**\n * Internal Utility Class\n * @class\n * @memberof module:concerto-util\n */\nclass NullUtil {\n\n /**\n * Returns true if the typeof the object === 'undefined' or\n * the object === null.\n * @param obj - the object to be tested\n * @returns true if the object is null or undefined\n */\n static isNull(obj: unknown): obj is null | undefined {\n return(typeof(obj) === 'undefined' || obj === null);\n }\n}\n\nexport { NullUtil };\nexport default NullUtil;\n"],
5
+ "mappings": ";;;;AAmBA,IAAM,WAAN,MAAe;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQX,OAAO,OAAO,KAAuC;AACjD,WAAO,OAAO,QAAS,eAAe,QAAQ;AAAA,EAClD;AACJ;AAGA,IAAO,eAAQ;",
6
+ "names": []
7
+ }
@@ -0,0 +1,33 @@
1
+ import { createRequire as __createRequire } from "module";
2
+ const require = __createRequire(import.meta.url);
3
+ import {
4
+ compositefileloader_default
5
+ } from "./chunk-I33X6SGY.mjs";
6
+ import {
7
+ githubfileloader_default
8
+ } from "./chunk-D4MNWWBB.mjs";
9
+ import {
10
+ httpfileloader_default
11
+ } from "./chunk-GOLEPEBI.mjs";
12
+
13
+ // src/loaders/defaultfileloader.ts
14
+ var DefaultFileLoader = class extends compositefileloader_default {
15
+ /**
16
+ * Create the DefaultFileLoader.
17
+ * @param processFile - a function to apply to the content of the file
18
+ */
19
+ constructor(processFile) {
20
+ super();
21
+ const http = new httpfileloader_default(processFile);
22
+ const github = new githubfileloader_default(processFile);
23
+ this.addFileLoader(github);
24
+ this.addFileLoader(http);
25
+ }
26
+ };
27
+ var defaultfileloader_default = DefaultFileLoader;
28
+
29
+ export {
30
+ DefaultFileLoader,
31
+ defaultfileloader_default
32
+ };
33
+ //# sourceMappingURL=chunk-PBL5N3A2.mjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/loaders/defaultfileloader.ts"],
4
+ "sourcesContent": ["/*\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport CompositeFileLoader from './compositefileloader';\nimport HTTPFileLoader from './httpfileloader';\nimport GitHubFileLoader from './githubfileloader';\n\n/**\n * <p>\n * A default CompositeFileLoader implementation which supports\n * github://, http:// and https:// URLs.\n * </p>\n * @private\n * @class\n * @see See {@link CompositeFileLoader}\n * @memberof module:concerto-util\n */\nclass DefaultFileLoader<T> extends CompositeFileLoader<T> {\n /**\n * Create the DefaultFileLoader.\n * @param processFile - a function to apply to the content of the file\n */\n constructor(processFile: (name: string, text: string) => T) {\n super();\n const http = new HTTPFileLoader(processFile);\n const github = new GitHubFileLoader(processFile);\n this.addFileLoader(github);\n this.addFileLoader(http);\n }\n}\n\nexport { DefaultFileLoader };\nexport default DefaultFileLoader;\n"],
5
+ "mappings": ";;;;;;;;;;;;;AA4BA,IAAM,oBAAN,cAAmC,4BAAuB;AAAA;AAAA;AAAA;AAAA;AAAA,EAKtD,YAAY,aAAgD;AACxD,UAAM;AACN,UAAM,OAAO,IAAI,uBAAe,WAAW;AAC3C,UAAM,SAAS,IAAI,yBAAiB,WAAW;AAC/C,SAAK,cAAc,MAAM;AACzB,SAAK,cAAc,IAAI;AAAA,EAC3B;AACJ;AAGA,IAAO,4BAAQ;",
6
+ "names": []
7
+ }
@@ -0,0 +1,17 @@
1
+ import { createRequire as __createRequire } from "module";
2
+ const require = __createRequire(import.meta.url);
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __commonJS = (cb, mod) => function __require() {
6
+ return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
7
+ };
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+
13
+ export {
14
+ __commonJS,
15
+ __export
16
+ };
17
+ //# sourceMappingURL=chunk-PMP2SMHG.mjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": [],
4
+ "sourcesContent": [],
5
+ "mappings": "",
6
+ "names": []
7
+ }
@@ -0,0 +1,151 @@
1
+ import { createRequire as __createRequire } from "module";
2
+ const require = __createRequire(import.meta.url);
3
+
4
+ // src/logger.ts
5
+ var levels = {
6
+ error: 0,
7
+ warn: 1,
8
+ info: 2,
9
+ http: 3,
10
+ verbose: 4,
11
+ debug: 5,
12
+ silly: 6
13
+ };
14
+ var timestamp = () => (/* @__PURE__ */ new Date()).toLocaleTimeString();
15
+ var prettifyJson = (obj) => {
16
+ return obj;
17
+ };
18
+ var defaultTransportShim = (level, ...args) => {
19
+ let mutatedLevel = level;
20
+ const data = args;
21
+ let first = data.shift();
22
+ if (first && typeof first === "object" && first.level && first.message) {
23
+ const padding = first.padding && first.padding[first.level];
24
+ if (first.level === "error" && first.stack) {
25
+ mutatedLevel = "error";
26
+ first = `${first.message}
27
+ ${first.stack}`;
28
+ } else if (Object.keys(levels).includes(first.level)) {
29
+ mutatedLevel = first.level;
30
+ first = first.message;
31
+ }
32
+ first = padding ? `${padding} ${first}` : first;
33
+ }
34
+ data.unshift(first);
35
+ const stream = ["error", "warn"].includes(mutatedLevel) ? console.error : console.log;
36
+ stream(
37
+ `${timestamp()} - ${mutatedLevel}:`,
38
+ ...data.map((obj) => obj instanceof Error ? `${obj.message}
39
+ ${obj.stack}` : obj).map(prettifyJson)
40
+ );
41
+ };
42
+ var defaultTransport = {};
43
+ Object.keys(levels).forEach((level) => {
44
+ const typedLevel = level;
45
+ defaultTransport[typedLevel] = (...args) => defaultTransportShim(typedLevel, ...args);
46
+ });
47
+ var Logger = class {
48
+ /**
49
+ * A reusable function for logging at multiple levels
50
+ * @param level - the required log level. e.g. error, warn, info, debug, etc.
51
+ * @param args - the input obj to prettify
52
+ */
53
+ static dispatch(level, ...args) {
54
+ if (levels[level] > levels[this.level]) {
55
+ return;
56
+ }
57
+ this.transports.forEach((t) => {
58
+ if (t[level]) {
59
+ t[level](...args);
60
+ }
61
+ });
62
+ }
63
+ /**
64
+ * Add a custom transport for logging
65
+ * @param transport - The transport object should have function for the usual logging operations e.g. error, warn, info, debug, etc.
66
+ */
67
+ static add(transport) {
68
+ this.transports.push(transport);
69
+ }
70
+ /**
71
+ * Write an error statement to the console.
72
+ *
73
+ * Prints to `stderr` with newline.
74
+ * @param args - args
75
+ */
76
+ static error(...args) {
77
+ this.dispatch("error", ...args);
78
+ }
79
+ /**
80
+ * Write a warning statement to the console.
81
+ *
82
+ * Prints to `stderr` with newline.
83
+ * @param args - args
84
+ */
85
+ static warn(...args) {
86
+ this.dispatch("warn", ...args);
87
+ }
88
+ /**
89
+ * Write an info statement to the console.
90
+ *
91
+ * Prints to `stdout` with newline.
92
+ * @param args - args
93
+ */
94
+ static info(...args) {
95
+ this.dispatch("info", ...args);
96
+ }
97
+ /**
98
+ * Write an info statement to the console. Alias for `logger.log`
99
+ *
100
+ * Prints to `stdout` with newline.
101
+ * @param args - args
102
+ */
103
+ static log(...args) {
104
+ this.info(...args);
105
+ }
106
+ /**
107
+ * Write an http statement to the console.
108
+ *
109
+ * Prints to `stdout` with newline.
110
+ * @param args - args
111
+ */
112
+ static http(...args) {
113
+ this.dispatch("http", ...args);
114
+ }
115
+ /**
116
+ * Write a verbose log statement to the console.
117
+ *
118
+ * Prints to `stdout` with newline.
119
+ * @param args - args
120
+ */
121
+ static verbose(...args) {
122
+ this.dispatch("verbose", ...args);
123
+ }
124
+ /**
125
+ * Write a debug statement to the console.
126
+ *
127
+ * Prints to `stdout` with newline.
128
+ * @param args - args
129
+ */
130
+ static debug(...args) {
131
+ this.dispatch("debug", ...args);
132
+ }
133
+ /**
134
+ * Write a silly level statement to the console.
135
+ *
136
+ * Prints to `stdout` with newline.
137
+ * @param args - args
138
+ */
139
+ static silly(...args) {
140
+ this.dispatch("silly", ...args);
141
+ }
142
+ };
143
+ Logger.level = "info";
144
+ Logger.transports = [defaultTransport];
145
+ var logger_default = Logger;
146
+
147
+ export {
148
+ Logger,
149
+ logger_default
150
+ };
151
+ //# sourceMappingURL=chunk-Q6G4HQJ7.mjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/logger.ts"],
4
+ "sourcesContent": ["/*\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/* eslint-disable no-console */\n/* eslint-disable no-use-before-define */\n\n/**\n * Default levels for the npm configuration.\n */\nconst levels: Record<string, number> = {\n error: 0,\n warn: 1,\n info: 2,\n http: 3,\n verbose: 4,\n debug: 5,\n silly: 6\n};\n\nconst timestamp = () => (new Date()).toLocaleTimeString();\n\n/**\n* Helper function to format JSON objects\n* @param obj - the input obj to prettify\n* @returns - the prettified object\n*/\nconst prettifyJson = (obj: unknown): unknown => {\n return obj;\n};\n\n/**\n* The default transport for logging at multiple levels to the console\n* @param level - the required log level. e.g. error, warn, info, debug, etc.\n* @param args - the input obj to prettify\n*/\ntype LogLevel = keyof typeof levels;\ntype Transport = Partial<Record<LogLevel, (...args: unknown[]) => void>>;\n\nconst defaultTransportShim = (level: LogLevel, ...args: any[]): void => {\n let mutatedLevel = level;\n const data = args;\n let first = data.shift();\n\n // Flatten log object\n if(first && typeof first === 'object' && first.level && first.message){\n const padding = first.padding && first.padding[first.level];\n if (first.level === 'error' && first.stack) {\n mutatedLevel = 'error';\n first = `${first.message}\\n${first.stack}`;\n } else if (Object.keys(levels).includes(first.level)) {\n mutatedLevel = first.level;\n first = first.message;\n }\n first = padding ? `${padding} ${first}` : first;\n }\n\n data.unshift(first);\n\n const stream = ['error', 'warn'].includes(mutatedLevel) ? console.error : console.log;\n\n stream(\n `${timestamp()} - ${mutatedLevel}:`,\n ...data\n .map(obj => obj instanceof Error ? `${obj.message}\\n${obj.stack}`: obj)\n .map(prettifyJson)\n );\n};\n\nconst defaultTransport: Record<LogLevel, (...args: unknown[]) => void> = {} as Record<LogLevel, (...args: unknown[]) => void>;\nObject.keys(levels).forEach(level => {\n const typedLevel = level as LogLevel;\n defaultTransport[typedLevel] = (...args: unknown[]) => defaultTransportShim(typedLevel, ...args);\n});\n\n/**\n * A utility class with static function that print to the console\n */\nclass Logger {\n static level = 'info';\n static transports: Transport[] = [ defaultTransport ];\n\n /**\n * A reusable function for logging at multiple levels\n * @param level - the required log level. e.g. error, warn, info, debug, etc.\n * @param args - the input obj to prettify\n */\n static dispatch(level: LogLevel, ...args: unknown[]): void {\n if (levels[level] > levels[this.level]){\n return;\n }\n\n this.transports.forEach(t => {\n if(t[level]){\n t[level](...args);\n }\n });\n }\n\n /**\n * Add a custom transport for logging\n * @param transport - The transport object should have function for the usual logging operations e.g. error, warn, info, debug, etc.\n */\n static add(transport: Transport): void {\n this.transports.push(transport);\n }\n\n /**\n * Write an error statement to the console.\n *\n * Prints to `stderr` with newline.\n * @param args - args\n */\n static error(...args: unknown[]): void{ this.dispatch('error', ...args); }\n\n /**\n * Write a warning statement to the console.\n *\n * Prints to `stderr` with newline.\n * @param args - args\n */\n static warn(...args: unknown[]): void{ this.dispatch('warn', ...args); }\n\n /**\n * Write an info statement to the console.\n *\n * Prints to `stdout` with newline.\n * @param args - args\n */\n static info(...args: unknown[]): void{ this.dispatch('info', ...args); }\n\n /**\n * Write an info statement to the console. Alias for `logger.log`\n *\n * Prints to `stdout` with newline.\n * @param args - args\n */\n static log(...args: unknown[]): void{ this.info(...args); }\n\n /**\n * Write an http statement to the console.\n *\n * Prints to `stdout` with newline.\n * @param args - args\n */\n static http(...args: unknown[]): void{ this.dispatch('http', ...args); }\n\n /**\n * Write a verbose log statement to the console.\n *\n * Prints to `stdout` with newline.\n * @param args - args\n */\n static verbose(...args: unknown[]): void{ this.dispatch('verbose', ...args); }\n\n /**\n * Write a debug statement to the console.\n *\n * Prints to `stdout` with newline.\n * @param args - args\n */\n static debug(...args: unknown[]): void{ this.dispatch('debug', ...args); }\n\n /**\n * Write a silly level statement to the console.\n *\n * Prints to `stdout` with newline.\n * @param args - args\n */\n static silly(...args: unknown[]): void{ this.dispatch('silly', ...args); }\n}\n\nexport { Logger };\nexport default Logger;\n"],
5
+ "mappings": "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",
6
+ "names": []
7
+ }
@@ -0,0 +1,51 @@
1
+ import { createRequire as __createRequire } from "module";
2
+ const require = __createRequire(import.meta.url);
3
+ import {
4
+ baseexception_default
5
+ } from "./chunk-G6IDW2UD.mjs";
6
+
7
+ // src/basefileexception.ts
8
+ var BaseFileException = class extends baseexception_default {
9
+ /**
10
+ * Create an BaseFileException
11
+ * @param message - the message for the exception
12
+ * @param fileLocation - the optional file location associated with the exception
13
+ * @param fullMessage - the optional full message text
14
+ * @param fileName - the file name
15
+ * @param component - the component which throws this error
16
+ */
17
+ constructor(message, fileLocation = null, fullMessage = null, fileName = null, component) {
18
+ super(fullMessage ? fullMessage : message, component);
19
+ this.fileLocation = fileLocation;
20
+ this.shortMessage = message;
21
+ this.fileName = fileName;
22
+ }
23
+ /**
24
+ * Returns the file location associated with the exception or null
25
+ * @return the optional location associated with the exception
26
+ */
27
+ getFileLocation() {
28
+ return this.fileLocation;
29
+ }
30
+ /**
31
+ * Returns the error message without the location of the error
32
+ * @returns the error message
33
+ */
34
+ getShortMessage() {
35
+ return this.shortMessage;
36
+ }
37
+ /**
38
+ * Returns the fileName for the error
39
+ * @returns the file name or null
40
+ */
41
+ getFileName() {
42
+ return this.fileName;
43
+ }
44
+ };
45
+ var basefileexception_default = BaseFileException;
46
+
47
+ export {
48
+ BaseFileException,
49
+ basefileexception_default
50
+ };
51
+ //# sourceMappingURL=chunk-RBUQLLXW.mjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/basefileexception.ts"],
4
+ "sourcesContent": ["/*\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport BaseException from './baseexception';\n\n/**\n * Exception throws when a Concerto file is semantically invalid\n * @extends BaseException\n * @see {@link BaseException}\n * @class\n * @memberof module:concerto-core\n */\nclass BaseFileException extends BaseException {\n public fileLocation: string | null;\n public shortMessage: string;\n public fileName: string | null;\n\n /**\n * Create an BaseFileException\n * @param message - the message for the exception\n * @param fileLocation - the optional file location associated with the exception\n * @param fullMessage - the optional full message text\n * @param fileName - the file name\n * @param component - the component which throws this error\n */\n constructor(message: string, fileLocation: string | null = null, fullMessage: string | null = null, fileName: string | null = null, component?: string) {\n super(fullMessage ? fullMessage : message, component);\n this.fileLocation = fileLocation;\n this.shortMessage = message;\n this.fileName = fileName;\n }\n\n /**\n * Returns the file location associated with the exception or null\n * @return the optional location associated with the exception\n */\n getFileLocation(): string | null {\n return this.fileLocation;\n }\n\n /**\n * Returns the error message without the location of the error\n * @returns the error message\n */\n getShortMessage(): string {\n return this.shortMessage;\n }\n\n /**\n * Returns the fileName for the error\n * @returns the file name or null\n */\n getFileName(): string | null {\n return this.fileName;\n }\n}\n\nexport { BaseFileException };\nexport default BaseFileException;\n"],
5
+ "mappings": ";;;;;;;AAuBA,IAAM,oBAAN,cAAgC,sBAAc;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAa1C,YAAY,SAAiB,eAA8B,MAAM,cAA6B,MAAM,WAA0B,MAAM,WAAoB;AACpJ,UAAM,cAAc,cAAc,SAAS,SAAS;AACpD,SAAK,eAAe;AACpB,SAAK,eAAe;AACpB,SAAK,WAAW;AAAA,EACpB;AAAA;AAAA;AAAA;AAAA;AAAA,EAMA,kBAAiC;AAC7B,WAAO,KAAK;AAAA,EAChB;AAAA;AAAA;AAAA;AAAA;AAAA,EAMA,kBAA0B;AACtB,WAAO,KAAK;AAAA,EAChB;AAAA;AAAA;AAAA;AAAA;AAAA,EAMA,cAA6B;AACzB,WAAO,KAAK;AAAA,EAChB;AACJ;AAGA,IAAO,4BAAQ;",
6
+ "names": []
7
+ }