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

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-3A2THGYW.mjs +51 -0
  10. package/dist/esm/chunk-3A2THGYW.mjs.map +7 -0
  11. package/dist/esm/chunk-3RJ6JXLX.mjs +29 -0
  12. package/dist/esm/chunk-3RJ6JXLX.mjs.map +7 -0
  13. package/dist/esm/chunk-3U4T7O4P.mjs +41 -0
  14. package/dist/esm/chunk-3U4T7O4P.mjs.map +7 -0
  15. package/dist/esm/chunk-5HVAQ6AX.mjs +183 -0
  16. package/dist/esm/chunk-5HVAQ6AX.mjs.map +7 -0
  17. package/dist/esm/chunk-D4MNWWBB.mjs +43 -0
  18. package/dist/esm/chunk-D4MNWWBB.mjs.map +7 -0
  19. package/dist/esm/chunk-DTVQ7VXD.mjs +30 -0
  20. package/dist/esm/chunk-DTVQ7VXD.mjs.map +7 -0
  21. package/dist/esm/chunk-FHUVVHGR.mjs +48 -0
  22. package/dist/esm/chunk-FHUVVHGR.mjs.map +7 -0
  23. package/dist/esm/chunk-FK2LDKS6.mjs +36 -0
  24. package/dist/esm/chunk-FK2LDKS6.mjs.map +7 -0
  25. package/dist/esm/chunk-GOLEPEBI.mjs +56 -0
  26. package/dist/esm/chunk-GOLEPEBI.mjs.map +7 -0
  27. package/dist/esm/chunk-I33X6SGY.mjs +70 -0
  28. package/dist/esm/chunk-I33X6SGY.mjs.map +7 -0
  29. package/dist/esm/chunk-K4OOJFK5.mjs +93 -0
  30. package/dist/esm/chunk-K4OOJFK5.mjs.map +7 -0
  31. package/dist/esm/chunk-LPNGJFU2.mjs +22 -0
  32. package/dist/esm/chunk-LPNGJFU2.mjs.map +7 -0
  33. package/dist/esm/chunk-PBL5N3A2.mjs +33 -0
  34. package/dist/esm/chunk-PBL5N3A2.mjs.map +7 -0
  35. package/dist/esm/chunk-PMP2SMHG.mjs +17 -0
  36. package/dist/esm/chunk-PMP2SMHG.mjs.map +7 -0
  37. package/dist/esm/chunk-Q6G4HQJ7.mjs +151 -0
  38. package/dist/esm/chunk-Q6G4HQJ7.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-FMBRY3SQ.mjs +183 -0
  106. package/dist/esm-browser/chunk-FMBRY3SQ.mjs.map +7 -0
  107. package/dist/esm-browser/chunk-LZTTRWN3.mjs +153 -0
  108. package/dist/esm-browser/chunk-LZTTRWN3.mjs.map +7 -0
  109. package/dist/esm-browser/chunk-MCUSZIV7.mjs +41 -0
  110. package/dist/esm-browser/chunk-MCUSZIV7.mjs.map +7 -0
  111. package/dist/esm-browser/chunk-N42BHUZ6.mjs +35 -0
  112. package/dist/esm-browser/chunk-N42BHUZ6.mjs.map +7 -0
  113. package/dist/esm-browser/chunk-NAP47VIV.mjs +36 -0
  114. package/dist/esm-browser/chunk-NAP47VIV.mjs.map +7 -0
  115. package/dist/esm-browser/chunk-NQ5PDAAD.mjs +95 -0
  116. package/dist/esm-browser/chunk-NQ5PDAAD.mjs.map +7 -0
  117. package/dist/esm-browser/chunk-NSJTBLWA.mjs +71 -0
  118. package/dist/esm-browser/chunk-NSJTBLWA.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-YI4IYGSC.mjs +53 -0
  126. package/dist/esm-browser/chunk-YI4IYGSC.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,26 @@
1
+ import {
2
+ __commonJS,
3
+ init_browser_process_shim
4
+ } from "./chunk-NSJTBLWA.mjs";
5
+
6
+ // node-builtin-stub:fs
7
+ var require_fs = __commonJS({
8
+ "node-builtin-stub:fs"(exports, module) {
9
+ init_browser_process_shim();
10
+ module.exports = {};
11
+ }
12
+ });
13
+
14
+ // node-builtin-stub:path
15
+ var require_path = __commonJS({
16
+ "node-builtin-stub:path"(exports, module) {
17
+ init_browser_process_shim();
18
+ module.exports = {};
19
+ }
20
+ });
21
+
22
+ export {
23
+ require_fs,
24
+ require_path
25
+ };
26
+ //# sourceMappingURL=chunk-DOL2YKDZ.mjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["node-builtin-stub:fs", "node-builtin-stub:path"],
4
+ "sourcesContent": ["module.exports = {};", "module.exports = {};"],
5
+ "mappings": ";;;;;;AAAA;AAAA;AAAA;AAAA,WAAO,UAAU,CAAC;AAAA;AAAA;;;ACAlB;AAAA;AAAA;AAAA,WAAO,UAAU,CAAC;AAAA;AAAA;",
6
+ "names": []
7
+ }
@@ -0,0 +1,62 @@
1
+ import {
2
+ require_browser
3
+ } from "./chunk-7LYWQ57N.mjs";
4
+ import {
5
+ __toESM,
6
+ init_browser_process_shim
7
+ } from "./chunk-NSJTBLWA.mjs";
8
+
9
+ // src/loaders/httpfileloader.ts
10
+ init_browser_process_shim();
11
+ var import_debug = __toESM(require_browser());
12
+ var debug = (0, import_debug.default)("concerto:HTTPFileLoader");
13
+ var HTTPFileLoader = class {
14
+ /**
15
+ * Create the HTTPFileLoader.
16
+ * @param processFile - a function to apply to the content of the file
17
+ */
18
+ constructor(processFile) {
19
+ this.processFile = processFile;
20
+ }
21
+ /**
22
+ * Returns true if this ModelLoader can process the URL
23
+ * @param url - the URL
24
+ * @return true if this ModelLoader accepts the URL
25
+ * @abstract
26
+ */
27
+ accepts(url) {
28
+ return url.startsWith("http://") || url.startsWith("https://");
29
+ }
30
+ /**
31
+ * Load a text File from a URL and return it
32
+ * @param requestUrl - the url to get
33
+ * @param options - additional options
34
+ * @return a promise to the File
35
+ */
36
+ async load(requestUrl, options) {
37
+ if (!options) {
38
+ options = {
39
+ method: "GET",
40
+ headers: {
41
+ "Content-Type": "text/plain"
42
+ }
43
+ };
44
+ }
45
+ debug("loading", requestUrl);
46
+ const response = await fetch(requestUrl, options);
47
+ if (!response.ok) {
48
+ throw new Error(`HTTP request failed with status: ${response.status}`);
49
+ }
50
+ const text = await response.text();
51
+ const url = new URL(requestUrl);
52
+ const name = "@" + (url.host + url.pathname).replace(/\//g, ".");
53
+ return this.processFile(name, text);
54
+ }
55
+ };
56
+ var httpfileloader_default = HTTPFileLoader;
57
+
58
+ export {
59
+ HTTPFileLoader,
60
+ httpfileloader_default
61
+ };
62
+ //# sourceMappingURL=chunk-EGOFDABS.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": ";;;;;;;;;AAAA;AAeA,mBAAwB;AAExB,IAAM,YAAQ,aAAAA,SAAY,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": ["createDebug"]
7
+ }
@@ -0,0 +1,183 @@
1
+ import {
2
+ DEFAULT_BASE_EXCEPTION
3
+ } from "./chunk-NAP47VIV.mjs";
4
+ import {
5
+ __commonJS,
6
+ init_browser_process_shim
7
+ } from "./chunk-NSJTBLWA.mjs";
8
+
9
+ // package.json
10
+ var require_package = __commonJS({
11
+ "package.json"(exports, module) {
12
+ module.exports = {
13
+ name: "@accordproject/concerto-util",
14
+ version: "4.2.0",
15
+ description: "Utilities for Concerto Modeling Language",
16
+ homepage: "https://github.com/accordproject/concerto",
17
+ engines: {
18
+ node: ">=18",
19
+ npm: ">=9"
20
+ },
21
+ main: "dist/index.js",
22
+ typings: "dist/index.d.ts",
23
+ scripts: {
24
+ clean: "rimraf dist",
25
+ prebuild: "npm-run-all clean",
26
+ pretest: "npm run lint",
27
+ lint: "eslint .",
28
+ postlint: "npm run licchk",
29
+ licchk: "license-check-and-add",
30
+ postlicchk: "npm run doc",
31
+ doc: "jsdoc --pedantic --recurse -c jsdoc.json",
32
+ test: "nyc mocha -r ts-node/register --recursive -t 10000",
33
+ "test:watch": "nyc mocha -r ts-node/register --watch --recursive -t 10000",
34
+ build: "tsc -p tsconfig.build.json && npm run build:esm",
35
+ "build:esm": "node ../../scripts/build-esm.js"
36
+ },
37
+ repository: {
38
+ type: "git",
39
+ url: "https://github.com/accordproject/concerto.git",
40
+ directory: "packages/concerto-util"
41
+ },
42
+ keywords: [
43
+ "blockchain",
44
+ "hyperledger",
45
+ "solutions"
46
+ ],
47
+ author: "accordproject.org",
48
+ license: "Apache-2.0",
49
+ devDependencies: {
50
+ "@istanbuljs/nyc-config-typescript": "1.0.2",
51
+ "@types/jest": "28.1.1",
52
+ "@types/node": "18.11.18",
53
+ "@types/semver": "7.3.10",
54
+ "@typescript-eslint/eslint-plugin": "^8.46.2",
55
+ "@typescript-eslint/parser": "^8.46.2",
56
+ chai: "4.3.6",
57
+ "chai-as-promised": "7.1.1",
58
+ "chai-things": "0.2.0",
59
+ eslint: "8.57.1",
60
+ jsdoc: "^4.0.2",
61
+ "license-check-and-add": "2.3.6",
62
+ mocha: "^10.8.2",
63
+ nock: "^13.3.8",
64
+ "npm-run-all": "4.1.5",
65
+ nyc: "15.1.0",
66
+ rimraf: "3.0.2",
67
+ "tmp-promise": "3.0.2",
68
+ "ts-jest": "28.0.4",
69
+ "ts-node": "10.9.1",
70
+ typescript: "5.9.3",
71
+ undici: "6.25.0"
72
+ },
73
+ dependencies: {
74
+ "@supercharge/promise-pool": "1.7.0",
75
+ colors: "1.4.0",
76
+ debug: "4.3.4",
77
+ slash: "3.0.0"
78
+ },
79
+ browserslist: "> 0.25%, not dead",
80
+ "license-check-and-add-config": {
81
+ folder: "./src",
82
+ license: "HEADER",
83
+ exact_paths_method: "EXCLUDE",
84
+ exact_paths: [
85
+ "api.txt",
86
+ "composer-logs",
87
+ "coverage",
88
+ "LICENSE",
89
+ "node_modules",
90
+ ".nyc-output",
91
+ "out",
92
+ ".tern-project"
93
+ ],
94
+ file_type_method: "EXCLUDE",
95
+ file_types: [
96
+ ".yml",
97
+ ".yaml",
98
+ ".zip",
99
+ ".tgz"
100
+ ],
101
+ insert_license: false,
102
+ license_formats: {
103
+ "js|ts|njk|pegjs|cto|acl|qry": {
104
+ prepend: "/*",
105
+ append: " */",
106
+ eachLine: {
107
+ prepend: " * "
108
+ }
109
+ },
110
+ "npmrc|editorconfig|txt": {
111
+ eachLine: {
112
+ prepend: "# "
113
+ }
114
+ },
115
+ md: {
116
+ file: "HEADER.md"
117
+ }
118
+ }
119
+ },
120
+ nyc: {
121
+ extends: "@istanbuljs/nyc-config-typescript",
122
+ "produce-source-map": "true",
123
+ reporter: [
124
+ "lcov",
125
+ "text-summary",
126
+ "html",
127
+ "json"
128
+ ],
129
+ include: [
130
+ "src/**/*.js",
131
+ "src/**/*.ts"
132
+ ],
133
+ all: true,
134
+ "check-coverage": true,
135
+ statements: 100,
136
+ branches: 94,
137
+ functions: 100,
138
+ lines: 100
139
+ },
140
+ module: "dist/esm/index.mjs",
141
+ exports: {
142
+ ".": {
143
+ types: "./dist/index.d.ts",
144
+ browser: "./dist/esm-browser/index.mjs",
145
+ import: "./dist/esm/index.mjs",
146
+ require: "./dist/index.js"
147
+ },
148
+ "./package.json": "./package.json",
149
+ "./dist/*": "./dist/*"
150
+ },
151
+ sideEffects: false
152
+ };
153
+ }
154
+ });
155
+
156
+ // src/baseexception.ts
157
+ init_browser_process_shim();
158
+ var packageJson = require_package();
159
+ var BaseException = class extends Error {
160
+ /**
161
+ * Create the BaseException.
162
+ * @param message - The exception message.
163
+ * @param component - The optional component which throws this error.
164
+ * @param errorType - The optional error code regarding the error
165
+ */
166
+ constructor(message, component, errorType) {
167
+ super(message);
168
+ this.component = component || packageJson.name;
169
+ this.name = this.constructor.name;
170
+ this.message = message;
171
+ this.errorType = errorType || DEFAULT_BASE_EXCEPTION;
172
+ if (typeof Error.captureStackTrace === "function") {
173
+ Error.captureStackTrace(this, this.constructor);
174
+ }
175
+ }
176
+ };
177
+ var baseexception_default = BaseException;
178
+
179
+ export {
180
+ BaseException,
181
+ baseexception_default
182
+ };
183
+ //# sourceMappingURL=chunk-FMBRY3SQ.mjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../package.json", "../../src/baseexception.ts"],
4
+ "sourcesContent": ["{\n \"name\": \"@accordproject/concerto-util\",\n \"version\": \"4.2.0\",\n \"description\": \"Utilities for Concerto Modeling Language\",\n \"homepage\": \"https://github.com/accordproject/concerto\",\n \"engines\": {\n \"node\": \">=18\",\n \"npm\": \">=9\"\n },\n \"main\": \"dist/index.js\",\n \"typings\": \"dist/index.d.ts\",\n \"scripts\": {\n \"clean\": \"rimraf dist\",\n \"prebuild\": \"npm-run-all clean\",\n \"pretest\": \"npm run lint\",\n \"lint\": \"eslint .\",\n \"postlint\": \"npm run licchk\",\n \"licchk\": \"license-check-and-add\",\n \"postlicchk\": \"npm run doc\",\n \"doc\": \"jsdoc --pedantic --recurse -c jsdoc.json\",\n \"test\": \"nyc mocha -r ts-node/register --recursive -t 10000\",\n \"test:watch\": \"nyc mocha -r ts-node/register --watch --recursive -t 10000\",\n \"build\": \"tsc -p tsconfig.build.json && npm run build:esm\",\n \"build:esm\": \"node ../../scripts/build-esm.js\"\n },\n \"repository\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/accordproject/concerto.git\",\n \"directory\": \"packages/concerto-util\"\n },\n \"keywords\": [\n \"blockchain\",\n \"hyperledger\",\n \"solutions\"\n ],\n \"author\": \"accordproject.org\",\n \"license\": \"Apache-2.0\",\n \"devDependencies\": {\n \"@istanbuljs/nyc-config-typescript\": \"1.0.2\",\n \"@types/jest\": \"28.1.1\",\n \"@types/node\": \"18.11.18\",\n \"@types/semver\": \"7.3.10\",\n \"@typescript-eslint/eslint-plugin\": \"^8.46.2\",\n \"@typescript-eslint/parser\": \"^8.46.2\",\n \"chai\": \"4.3.6\",\n \"chai-as-promised\": \"7.1.1\",\n \"chai-things\": \"0.2.0\",\n \"eslint\": \"8.57.1\",\n \"jsdoc\": \"^4.0.2\",\n \"license-check-and-add\": \"2.3.6\",\n \"mocha\": \"^10.8.2\",\n \"nock\": \"^13.3.8\",\n \"npm-run-all\": \"4.1.5\",\n \"nyc\": \"15.1.0\",\n \"rimraf\": \"3.0.2\",\n \"tmp-promise\": \"3.0.2\",\n \"ts-jest\": \"28.0.4\",\n \"ts-node\": \"10.9.1\",\n \"typescript\": \"5.9.3\",\n \"undici\": \"6.25.0\"\n },\n \"dependencies\": {\n \"@supercharge/promise-pool\": \"1.7.0\",\n \"colors\": \"1.4.0\",\n \"debug\": \"4.3.4\",\n \"slash\": \"3.0.0\"\n },\n \"browserslist\": \"> 0.25%, not dead\",\n \"license-check-and-add-config\": {\n \"folder\": \"./src\",\n \"license\": \"HEADER\",\n \"exact_paths_method\": \"EXCLUDE\",\n \"exact_paths\": [\n \"api.txt\",\n \"composer-logs\",\n \"coverage\",\n \"LICENSE\",\n \"node_modules\",\n \".nyc-output\",\n \"out\",\n \".tern-project\"\n ],\n \"file_type_method\": \"EXCLUDE\",\n \"file_types\": [\n \".yml\",\n \".yaml\",\n \".zip\",\n \".tgz\"\n ],\n \"insert_license\": false,\n \"license_formats\": {\n \"js|ts|njk|pegjs|cto|acl|qry\": {\n \"prepend\": \"/*\",\n \"append\": \" */\",\n \"eachLine\": {\n \"prepend\": \" * \"\n }\n },\n \"npmrc|editorconfig|txt\": {\n \"eachLine\": {\n \"prepend\": \"# \"\n }\n },\n \"md\": {\n \"file\": \"HEADER.md\"\n }\n }\n },\n \"nyc\": {\n \"extends\": \"@istanbuljs/nyc-config-typescript\",\n \"produce-source-map\": \"true\",\n \"reporter\": [\n \"lcov\",\n \"text-summary\",\n \"html\",\n \"json\"\n ],\n \"include\": [\n \"src/**/*.js\",\n \"src/**/*.ts\"\n ],\n \"all\": true,\n \"check-coverage\": true,\n \"statements\": 100,\n \"branches\": 94,\n \"functions\": 100,\n \"lines\": 100\n },\n \"module\": \"dist/esm/index.mjs\",\n \"exports\": {\n \".\": {\n \"types\": \"./dist/index.d.ts\",\n \"browser\": \"./dist/esm-browser/index.mjs\",\n \"import\": \"./dist/esm/index.mjs\",\n \"require\": \"./dist/index.js\"\n },\n \"./package.json\": \"./package.json\",\n \"./dist/*\": \"./dist/*\"\n },\n \"sideEffects\": false\n}\n", "/*\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 * as ErrorCodes from './errorcodes';\n// eslint-disable-next-line @typescript-eslint/no-var-requires\nconst packageJson = require('../package.json');\n\n/**\n* A base class for all Concerto exceptions\n* @extends Error\n* @class\n* @memberof module:concerto-core\n*/\nclass BaseException extends Error {\n public component: string;\n public errorType: string;\n\n /**\n * Create the BaseException.\n * @param message - The exception message.\n * @param component - The optional component which throws this error.\n * @param errorType - The optional error code regarding the error\n */\n constructor(message: string, component?: string, errorType?: string) {\n super(message);\n this.component = component || packageJson.name;\n this.name = this.constructor.name;\n this.message = message;\n this.errorType = errorType || ErrorCodes.DEFAULT_BASE_EXCEPTION;\n if (typeof Error.captureStackTrace === 'function') {\n Error.captureStackTrace(this, this.constructor);\n }\n }\n}\n\nexport { BaseException };\nexport default BaseException;\n"],
5
+ "mappings": ";;;;;;;;;AAAA;AAAA;AAAA;AAAA,MACE,MAAQ;AAAA,MACR,SAAW;AAAA,MACX,aAAe;AAAA,MACf,UAAY;AAAA,MACZ,SAAW;AAAA,QACT,MAAQ;AAAA,QACR,KAAO;AAAA,MACT;AAAA,MACA,MAAQ;AAAA,MACR,SAAW;AAAA,MACX,SAAW;AAAA,QACT,OAAS;AAAA,QACT,UAAY;AAAA,QACZ,SAAW;AAAA,QACX,MAAQ;AAAA,QACR,UAAY;AAAA,QACZ,QAAU;AAAA,QACV,YAAc;AAAA,QACd,KAAO;AAAA,QACP,MAAQ;AAAA,QACR,cAAc;AAAA,QACd,OAAS;AAAA,QACT,aAAa;AAAA,MACf;AAAA,MACA,YAAc;AAAA,QACZ,MAAQ;AAAA,QACR,KAAO;AAAA,QACP,WAAa;AAAA,MACf;AAAA,MACA,UAAY;AAAA,QACV;AAAA,QACA;AAAA,QACA;AAAA,MACF;AAAA,MACA,QAAU;AAAA,MACV,SAAW;AAAA,MACX,iBAAmB;AAAA,QACjB,qCAAqC;AAAA,QACrC,eAAe;AAAA,QACf,eAAe;AAAA,QACf,iBAAiB;AAAA,QACjB,oCAAoC;AAAA,QACpC,6BAA6B;AAAA,QAC7B,MAAQ;AAA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AAAA,QACb,OAAS;AAAA,MACX;AAAA,MACA,QAAU;AAAA,MACV,SAAW;AAAA,QACT,KAAK;AAAA,UACH,OAAS;AAAA,UACT,SAAW;AAAA,UACX,QAAU;AAAA,UACV,SAAW;AAAA,QACb;AAAA,QACA,kBAAkB;AAAA,QAClB,YAAY;AAAA,MACd;AAAA,MACA,aAAe;AAAA,IACjB;AAAA;AAAA;;;AC5IA;AAgBA,IAAM,cAAc;AAQpB,IAAM,gBAAN,cAA4B,MAAM;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAU9B,YAAY,SAAiB,WAAoB,WAAoB;AACjE,UAAM,OAAO;AACb,SAAK,YAAY,aAAa,YAAY;AAC1C,SAAK,OAAO,KAAK,YAAY;AAC7B,SAAK,UAAU;AACf,SAAK,YAAY,aAAwB;AACzC,QAAI,OAAO,MAAM,sBAAsB,YAAY;AAC/C,YAAM,kBAAkB,MAAM,KAAK,WAAW;AAAA,IAClD;AAAA,EACJ;AACJ;AAGA,IAAO,wBAAQ;",
6
+ "names": []
7
+ }
@@ -0,0 +1,153 @@
1
+ import {
2
+ init_browser_process_shim
3
+ } from "./chunk-NSJTBLWA.mjs";
4
+
5
+ // src/logger.ts
6
+ init_browser_process_shim();
7
+ var levels = {
8
+ error: 0,
9
+ warn: 1,
10
+ info: 2,
11
+ http: 3,
12
+ verbose: 4,
13
+ debug: 5,
14
+ silly: 6
15
+ };
16
+ var timestamp = () => (/* @__PURE__ */ new Date()).toLocaleTimeString();
17
+ var prettifyJson = (obj) => {
18
+ return obj;
19
+ };
20
+ var defaultTransportShim = (level, ...args) => {
21
+ let mutatedLevel = level;
22
+ const data = args;
23
+ let first = data.shift();
24
+ if (first && typeof first === "object" && first.level && first.message) {
25
+ const padding = first.padding && first.padding[first.level];
26
+ if (first.level === "error" && first.stack) {
27
+ mutatedLevel = "error";
28
+ first = `${first.message}
29
+ ${first.stack}`;
30
+ } else if (Object.keys(levels).includes(first.level)) {
31
+ mutatedLevel = first.level;
32
+ first = first.message;
33
+ }
34
+ first = padding ? `${padding} ${first}` : first;
35
+ }
36
+ data.unshift(first);
37
+ const stream = ["error", "warn"].includes(mutatedLevel) ? console.error : console.log;
38
+ stream(
39
+ `${timestamp()} - ${mutatedLevel}:`,
40
+ ...data.map((obj) => obj instanceof Error ? `${obj.message}
41
+ ${obj.stack}` : obj).map(prettifyJson)
42
+ );
43
+ };
44
+ var defaultTransport = {};
45
+ Object.keys(levels).forEach((level) => {
46
+ const typedLevel = level;
47
+ defaultTransport[typedLevel] = (...args) => defaultTransportShim(typedLevel, ...args);
48
+ });
49
+ var Logger = class {
50
+ /**
51
+ * A reusable function for logging at multiple levels
52
+ * @param level - the required log level. e.g. error, warn, info, debug, etc.
53
+ * @param args - the input obj to prettify
54
+ */
55
+ static dispatch(level, ...args) {
56
+ if (levels[level] > levels[this.level]) {
57
+ return;
58
+ }
59
+ this.transports.forEach((t) => {
60
+ if (t[level]) {
61
+ t[level](...args);
62
+ }
63
+ });
64
+ }
65
+ /**
66
+ * Add a custom transport for logging
67
+ * @param transport - The transport object should have function for the usual logging operations e.g. error, warn, info, debug, etc.
68
+ */
69
+ static add(transport) {
70
+ this.transports.push(transport);
71
+ }
72
+ /**
73
+ * Write an error statement to the console.
74
+ *
75
+ * Prints to `stderr` with newline.
76
+ * @param args - args
77
+ */
78
+ static error(...args) {
79
+ this.dispatch("error", ...args);
80
+ }
81
+ /**
82
+ * Write a warning statement to the console.
83
+ *
84
+ * Prints to `stderr` with newline.
85
+ * @param args - args
86
+ */
87
+ static warn(...args) {
88
+ this.dispatch("warn", ...args);
89
+ }
90
+ /**
91
+ * Write an info statement to the console.
92
+ *
93
+ * Prints to `stdout` with newline.
94
+ * @param args - args
95
+ */
96
+ static info(...args) {
97
+ this.dispatch("info", ...args);
98
+ }
99
+ /**
100
+ * Write an info statement to the console. Alias for `logger.log`
101
+ *
102
+ * Prints to `stdout` with newline.
103
+ * @param args - args
104
+ */
105
+ static log(...args) {
106
+ this.info(...args);
107
+ }
108
+ /**
109
+ * Write an http statement to the console.
110
+ *
111
+ * Prints to `stdout` with newline.
112
+ * @param args - args
113
+ */
114
+ static http(...args) {
115
+ this.dispatch("http", ...args);
116
+ }
117
+ /**
118
+ * Write a verbose log statement to the console.
119
+ *
120
+ * Prints to `stdout` with newline.
121
+ * @param args - args
122
+ */
123
+ static verbose(...args) {
124
+ this.dispatch("verbose", ...args);
125
+ }
126
+ /**
127
+ * Write a debug statement to the console.
128
+ *
129
+ * Prints to `stdout` with newline.
130
+ * @param args - args
131
+ */
132
+ static debug(...args) {
133
+ this.dispatch("debug", ...args);
134
+ }
135
+ /**
136
+ * Write a silly level statement to the console.
137
+ *
138
+ * Prints to `stdout` with newline.
139
+ * @param args - args
140
+ */
141
+ static silly(...args) {
142
+ this.dispatch("silly", ...args);
143
+ }
144
+ };
145
+ Logger.level = "info";
146
+ Logger.transports = [defaultTransport];
147
+ var logger_default = Logger;
148
+
149
+ export {
150
+ Logger,
151
+ logger_default
152
+ };
153
+ //# sourceMappingURL=chunk-LZTTRWN3.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": ";;;;;AAAA;AAoBA,IAAM,SAAiC;AAAA,EACnC,OAAO;AAAA,EACP,MAAM;AAAA,EACN,MAAM;AAAA,EACN,MAAM;AAAA,EACN,SAAS;AAAA,EACT,OAAO;AAAA,EACP,OAAO;AACX;AAEA,IAAM,YAAY,OAAO,oBAAI,KAAK,GAAG,mBAAmB;AAOxD,IAAM,eAAe,CAAC,QAA0B;AAC5C,SAAO;AACX;AAUA,IAAM,uBAAuB,CAAC,UAAoB,SAAsB;AACpE,MAAI,eAAe;AACnB,QAAM,OAAO;AACb,MAAI,QAAQ,KAAK,MAAM;AAGvB,M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REGEX,
10
+ normalizeIdentifier: () => normalizeIdentifier
11
+ });
12
+ init_browser_process_shim();
13
+ var ID_REGEX = /^(\p{Lu}|\p{Ll}|\p{Lt}|\p{Lm}|\p{Lo}|\p{Nl}|\$|_|\\u[0-9A-Fa-f]{4})(?:\p{Lu}|\p{Ll}|\p{Lt}|\p{Lm}|\p{Lo}|\p{Nl}|\$|_|\\u[0-9A-Fa-f]{4}|\p{Mn}|\p{Mc}|\p{Nd}|\p{Pc}|\u200C|\u200D)*$/u;
14
+ function normalizeIdentifier(identifier, truncateLength = -1) {
15
+ const replacer = (_match, group1) => {
16
+ let escapedChar = "";
17
+ for (const codePoint of group1) {
18
+ escapedChar += `_${codePoint.codePointAt(0).toString(16)}`;
19
+ }
20
+ return escapedChar;
21
+ };
22
+ let result = identifier ?? String(identifier);
23
+ if (typeof result !== "string") {
24
+ throw new Error(`Unsupported identifier type, '${typeof result}'.`);
25
+ }
26
+ result = result.replace(/^(?:\p{Nd}|\p{Mn}|\p{Mc}|(?!_)\p{Pc})/u, "_$&").replace(/[-‐−@#:;><|/\\\u200c\u200d]/g, "_").replace(/\s/g, "_").replace(/(?!\p{Lu}|\p{Ll}|\p{Lt}|\p{Lm}|\p{Lo}|\p{Nl}|\$|_|\p{Mn}|\p{Mc}|\p{Nd}|\p{Pc}|\u200C|\u200D|\\u[0-9A-Fa-f]{4})(.)/gu, replacer).replace(/([\uD800-\uDFFF])/g, replacer);
27
+ if (truncateLength > 0) {
28
+ result = result.substring(0, truncateLength);
29
+ }
30
+ if (!ID_REGEX.test(result)) {
31
+ throw new Error(`Unexpected error. Not able to escape identifier '${result}'.`);
32
+ }
33
+ return result;
34
+ }
35
+
36
+ export {
37
+ ID_REGEX,
38
+ normalizeIdentifier,
39
+ identifiers_exports
40
+ };
41
+ //# sourceMappingURL=chunk-MCUSZIV7.mjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/identifiers.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'use strict';\n\n// Conforms to Concerto Spec for identifiers\nexport const ID_REGEX = /^(\\p{Lu}|\\p{Ll}|\\p{Lt}|\\p{Lm}|\\p{Lo}|\\p{Nl}|\\$|_|\\\\u[0-9A-Fa-f]{4})(?:\\p{Lu}|\\p{Ll}|\\p{Lt}|\\p{Lm}|\\p{Lo}|\\p{Nl}|\\$|_|\\\\u[0-9A-Fa-f]{4}|\\p{Mn}|\\p{Mc}|\\p{Nd}|\\p{Pc}|\\u200C|\\u200D)*$/u;\n\n/**\n * Function that attempts to normalize arbitrary strings\n * into valid Concerto identifiers\n *\n * @param identifier - the input value\n * @param truncateLength - Length at which to truncate the identifier\n * @returns - An identifier that meets the Concerto specification\n */\nexport function normalizeIdentifier(identifier: string | null | undefined, truncateLength: number = -1): string {\n const replacer = (_match: string, group1: string) => {\n let escapedChar = '';\n // Loop through characters with multiple code points\n for (const codePoint of group1) {\n // @ts-ignore\n escapedChar += `_${codePoint.codePointAt(0).toString(16)}`;\n }\n return escapedChar;\n };\n\n // Stringify null & undefined values\n let result = identifier ?? String(identifier);\n\n if (typeof result !== 'string'){\n throw new Error(`Unsupported identifier type, '${typeof result}'.`);\n }\n\n // 1. If the identifier begins with a character that is only valid as a\n // continuation, a digit, a combining mark or a connector other than _,\n // add a leading underscore\n result = result\n .replace(/^(?:\\p{Nd}|\\p{Mn}|\\p{Mc}|(?!_)\\p{Pc})/u, '_$&')\n\n // 2. Substitute Whitespace, and joiners\n .replace(/[-\u2010\u2212@#:;><|/\\\\\\u200c\\u200d]/g, '_')\n .replace(/\\s/g, '_')\n\n // 3a. Replace Invalid Characters\n .replace(/(?!\\p{Lu}|\\p{Ll}|\\p{Lt}|\\p{Lm}|\\p{Lo}|\\p{Nl}|\\$|_|\\p{Mn}|\\p{Mc}|\\p{Nd}|\\p{Pc}|\\u200C|\\u200D|\\\\u[0-9A-Fa-f]{4})(.)/gu, replacer)\n\n // 3b. Escape Surrogate Pairs\n .replace(/([\\uD800-\\uDFFF])/g, replacer);\n\n // 4. Optionally truncate the identifier\n if (truncateLength > 0){\n result = result.substring(0,truncateLength);\n }\n\n // Check validity\n if (!ID_REGEX.test(result)){\n throw new Error(`Unexpected error. Not able to escape identifier '${result}'.`);\n }\n return result;\n}"],
5
+ "mappings": ";;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAiBO,IAAM,WAAW;AAUjB,SAAS,oBAAoB,YAAuC,iBAAyB,IAAY;AAC5G,QAAM,WAAW,CAAC,QAAgB,WAAmB;AACjD,QAAI,cAAc;AAElB,eAAW,aAAa,QAAQ;AAE5B,qBAAe,IAAI,UAAU,YAAY,CAAC,EAAE,SAAS,EAAE,CAAC;AAAA,IAC5D;AACA,WAAO;AAAA,EACX;AAGA,MAAI,SAAS,cAAc,OAAO,UAAU;AAE5C,MAAI,OAAO,WAAW,UAAS;AAC3B,UAAM,IAAI,MAAM,iCAAiC,OAAO,MAAM,IAAI;AAAA,EACtE;AAKA,WAAS,OACJ,QAAQ,0CAA0C,KAAK,EAGvD,QAAQ,gCAAgC,GAAG,EAC3C,QAAQ,OAAO,GAAG,EAGlB,QAAQ,uHAAuH,QAAQ,EAGvI,QAAQ,sBAAsB,QAAQ;AAG3C,MAAI,iBAAiB,GAAE;AACnB,aAAS,OAAO,UAAU,GAAE,cAAc;AAAA,EAC9C;AAGA,MAAI,CAAC,SAAS,KAAK,MAAM,GAAE;AACvB,UAAM,IAAI,MAAM,oDAAoD,MAAM,IAAI;AAAA,EAClF;AACA,SAAO;AACX;",
6
+ "names": []
7
+ }
@@ -0,0 +1,35 @@
1
+ import {
2
+ compositefileloader_default
3
+ } from "./chunk-BDMF4RRF.mjs";
4
+ import {
5
+ githubfileloader_default
6
+ } from "./chunk-SU6SG5PJ.mjs";
7
+ import {
8
+ httpfileloader_default
9
+ } from "./chunk-EGOFDABS.mjs";
10
+ import {
11
+ init_browser_process_shim
12
+ } from "./chunk-NSJTBLWA.mjs";
13
+
14
+ // src/loaders/defaultfileloader.ts
15
+ init_browser_process_shim();
16
+ var DefaultFileLoader = class extends compositefileloader_default {
17
+ /**
18
+ * Create the DefaultFileLoader.
19
+ * @param processFile - a function to apply to the content of the file
20
+ */
21
+ constructor(processFile) {
22
+ super();
23
+ const http = new httpfileloader_default(processFile);
24
+ const github = new githubfileloader_default(processFile);
25
+ this.addFileLoader(github);
26
+ this.addFileLoader(http);
27
+ }
28
+ };
29
+ var defaultfileloader_default = DefaultFileLoader;
30
+
31
+ export {
32
+ DefaultFileLoader,
33
+ defaultfileloader_default
34
+ };
35
+ //# sourceMappingURL=chunk-N42BHUZ6.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": ";;;;;;;;;;;;;;AAAA;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,36 @@
1
+ import {
2
+ __export,
3
+ init_browser_process_shim
4
+ } from "./chunk-NSJTBLWA.mjs";
5
+
6
+ // src/errorcodes.ts
7
+ var errorcodes_exports = {};
8
+ __export(errorcodes_exports, {
9
+ CONCERTO_DEPRECATION_001: () => CONCERTO_DEPRECATION_001,
10
+ CONCERTO_DEPRECATION_002: () => CONCERTO_DEPRECATION_002,
11
+ DEFAULT_BASE_EXCEPTION: () => DEFAULT_BASE_EXCEPTION,
12
+ DEFAULT_VALIDATOR_EXCEPTION: () => DEFAULT_VALIDATOR_EXCEPTION,
13
+ DEPRECATION_WARNING: () => DEPRECATION_WARNING,
14
+ REGEX_VALIDATOR_EXCEPTION: () => REGEX_VALIDATOR_EXCEPTION,
15
+ TYPE_NOT_FOUND_EXCEPTION: () => TYPE_NOT_FOUND_EXCEPTION
16
+ });
17
+ init_browser_process_shim();
18
+ var DEFAULT_BASE_EXCEPTION = "DefaultBaseException";
19
+ var DEFAULT_VALIDATOR_EXCEPTION = "DefaultValidatorException";
20
+ var REGEX_VALIDATOR_EXCEPTION = "RegexValidatorException";
21
+ var TYPE_NOT_FOUND_EXCEPTION = "TypeNotFoundException";
22
+ var DEPRECATION_WARNING = "DeprecationWarning";
23
+ var CONCERTO_DEPRECATION_001 = "concerto-dep:001";
24
+ var CONCERTO_DEPRECATION_002 = "concerto-dep:002";
25
+
26
+ export {
27
+ DEFAULT_BASE_EXCEPTION,
28
+ DEFAULT_VALIDATOR_EXCEPTION,
29
+ REGEX_VALIDATOR_EXCEPTION,
30
+ TYPE_NOT_FOUND_EXCEPTION,
31
+ DEPRECATION_WARNING,
32
+ CONCERTO_DEPRECATION_001,
33
+ CONCERTO_DEPRECATION_002,
34
+ errorcodes_exports
35
+ };
36
+ //# sourceMappingURL=chunk-NAP47VIV.mjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/errorcodes.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'use strict';\n\n//default base exception\nexport const DEFAULT_BASE_EXCEPTION = 'DefaultBaseException';\n//default validator exception which is being used when there is no specified validator exception in introspect\nexport const DEFAULT_VALIDATOR_EXCEPTION = 'DefaultValidatorException';\n// exception code for regex validator format error\nexport const REGEX_VALIDATOR_EXCEPTION = 'RegexValidatorException';\n// base exception for Type not found\nexport const TYPE_NOT_FOUND_EXCEPTION = 'TypeNotFoundException';\n// deprecation warning type for process.emitWarning\nexport const DEPRECATION_WARNING = 'DeprecationWarning';\n\n\n//deprecation codes\nexport const CONCERTO_DEPRECATION_001 = 'concerto-dep:001';\nexport const CONCERTO_DEPRECATION_002 = 'concerto-dep:002';\n"],
5
+ "mappings": ";;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAiBO,IAAM,yBAAyB;AAE/B,IAAM,8BAA8B;AAEpC,IAAM,4BAA4B;AAElC,IAAM,2BAA2B;AAEjC,IAAM,sBAAsB;AAI5B,IAAM,2BAA2B;AACjC,IAAM,2BAA2B;",
6
+ "names": []
7
+ }