@cyberismo/data-handler 0.0.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 (306) hide show
  1. package/LICENSE +702 -0
  2. package/dist/card-metadata-updater.d.ts +33 -0
  3. package/dist/card-metadata-updater.js +121 -0
  4. package/dist/card-metadata-updater.js.map +1 -0
  5. package/dist/command-handler.d.ts +96 -0
  6. package/dist/command-handler.js +557 -0
  7. package/dist/command-handler.js.map +1 -0
  8. package/dist/command-manager.d.ts +43 -0
  9. package/dist/command-manager.js +73 -0
  10. package/dist/command-manager.js.map +1 -0
  11. package/dist/commands/calculate.d.ts +86 -0
  12. package/dist/commands/calculate.js +444 -0
  13. package/dist/commands/calculate.js.map +1 -0
  14. package/dist/commands/create.d.ts +114 -0
  15. package/dist/commands/create.js +389 -0
  16. package/dist/commands/create.js.map +1 -0
  17. package/dist/commands/edit.d.ts +37 -0
  18. package/dist/commands/edit.js +99 -0
  19. package/dist/commands/edit.js.map +1 -0
  20. package/dist/commands/export-site.d.ts +45 -0
  21. package/dist/commands/export-site.js +301 -0
  22. package/dist/commands/export-site.js.map +1 -0
  23. package/dist/commands/export.d.ts +53 -0
  24. package/dist/commands/export.js +251 -0
  25. package/dist/commands/export.js.map +1 -0
  26. package/dist/commands/import.d.ts +53 -0
  27. package/dist/commands/import.js +133 -0
  28. package/dist/commands/import.js.map +1 -0
  29. package/dist/commands/index.d.ts +26 -0
  30. package/dist/commands/index.js +27 -0
  31. package/dist/commands/index.js.map +1 -0
  32. package/dist/commands/move.d.ts +55 -0
  33. package/dist/commands/move.js +341 -0
  34. package/dist/commands/move.js.map +1 -0
  35. package/dist/commands/remove.d.ts +38 -0
  36. package/dist/commands/remove.js +192 -0
  37. package/dist/commands/remove.js.map +1 -0
  38. package/dist/commands/rename.d.ts +46 -0
  39. package/dist/commands/rename.js +289 -0
  40. package/dist/commands/rename.js.map +1 -0
  41. package/dist/commands/show.d.ts +124 -0
  42. package/dist/commands/show.js +345 -0
  43. package/dist/commands/show.js.map +1 -0
  44. package/dist/commands/transition.d.ts +27 -0
  45. package/dist/commands/transition.js +92 -0
  46. package/dist/commands/transition.js.map +1 -0
  47. package/dist/commands/update.d.ts +29 -0
  48. package/dist/commands/update.js +64 -0
  49. package/dist/commands/update.js.map +1 -0
  50. package/dist/commands/validate.d.ts +143 -0
  51. package/dist/commands/validate.js +689 -0
  52. package/dist/commands/validate.js.map +1 -0
  53. package/dist/containers/card-container.d.ts +44 -0
  54. package/dist/containers/card-container.js +282 -0
  55. package/dist/containers/card-container.js.map +1 -0
  56. package/dist/containers/project/project-paths.d.ts +46 -0
  57. package/dist/containers/project/project-paths.js +105 -0
  58. package/dist/containers/project/project-paths.js.map +1 -0
  59. package/dist/containers/project/resource-collector.d.ts +86 -0
  60. package/dist/containers/project/resource-collector.js +331 -0
  61. package/dist/containers/project/resource-collector.js.map +1 -0
  62. package/dist/containers/project.d.ts +351 -0
  63. package/dist/containers/project.js +896 -0
  64. package/dist/containers/project.js.map +1 -0
  65. package/dist/containers/template.d.ts +108 -0
  66. package/dist/containers/template.js +433 -0
  67. package/dist/containers/template.js.map +1 -0
  68. package/dist/exceptions/index.d.ts +19 -0
  69. package/dist/exceptions/index.js +26 -0
  70. package/dist/exceptions/index.js.map +1 -0
  71. package/dist/index.d.ts +16 -0
  72. package/dist/index.js +15 -0
  73. package/dist/index.js.map +1 -0
  74. package/dist/interfaces/adoc.d.ts +12 -0
  75. package/dist/interfaces/adoc.js +13 -0
  76. package/dist/interfaces/adoc.js.map +1 -0
  77. package/dist/interfaces/macros.d.ts +45 -0
  78. package/dist/interfaces/macros.js +13 -0
  79. package/dist/interfaces/macros.js.map +1 -0
  80. package/dist/interfaces/project-interfaces.d.ts +121 -0
  81. package/dist/interfaces/project-interfaces.js +21 -0
  82. package/dist/interfaces/project-interfaces.js.map +1 -0
  83. package/dist/interfaces/request-status-interfaces.d.ts +28 -0
  84. package/dist/interfaces/request-status-interfaces.js +20 -0
  85. package/dist/interfaces/request-status-interfaces.js.map +1 -0
  86. package/dist/interfaces/resource-interfaces.d.ts +117 -0
  87. package/dist/interfaces/resource-interfaces.js +20 -0
  88. package/dist/interfaces/resource-interfaces.js.map +1 -0
  89. package/dist/macros/base-macro.d.ts +31 -0
  90. package/dist/macros/base-macro.js +126 -0
  91. package/dist/macros/base-macro.js.map +1 -0
  92. package/dist/macros/common.d.ts +17 -0
  93. package/dist/macros/common.js +23 -0
  94. package/dist/macros/common.js.map +1 -0
  95. package/dist/macros/createCards/index.d.ts +36 -0
  96. package/dist/macros/createCards/index.js +35 -0
  97. package/dist/macros/createCards/index.js.map +1 -0
  98. package/dist/macros/createCards/metadata.d.ts +14 -0
  99. package/dist/macros/createCards/metadata.js +18 -0
  100. package/dist/macros/createCards/metadata.js.map +1 -0
  101. package/dist/macros/graph/index.d.ts +29 -0
  102. package/dist/macros/graph/index.js +91 -0
  103. package/dist/macros/graph/index.js.map +1 -0
  104. package/dist/macros/graph/metadata.d.ts +14 -0
  105. package/dist/macros/graph/metadata.js +18 -0
  106. package/dist/macros/graph/metadata.js.map +1 -0
  107. package/dist/macros/index.d.ts +93 -0
  108. package/dist/macros/index.js +237 -0
  109. package/dist/macros/index.js.map +1 -0
  110. package/dist/macros/report/index.d.ts +26 -0
  111. package/dist/macros/report/index.js +70 -0
  112. package/dist/macros/report/index.js.map +1 -0
  113. package/dist/macros/report/metadata.d.ts +14 -0
  114. package/dist/macros/report/metadata.js +18 -0
  115. package/dist/macros/report/metadata.js.map +1 -0
  116. package/dist/macros/scoreCard/index.d.ts +30 -0
  117. package/dist/macros/scoreCard/index.js +38 -0
  118. package/dist/macros/scoreCard/index.js.map +1 -0
  119. package/dist/macros/scoreCard/metadata.d.ts +14 -0
  120. package/dist/macros/scoreCard/metadata.js +18 -0
  121. package/dist/macros/scoreCard/metadata.js.map +1 -0
  122. package/dist/macros/task-queue.d.ts +46 -0
  123. package/dist/macros/task-queue.js +69 -0
  124. package/dist/macros/task-queue.js.map +1 -0
  125. package/dist/module-manager.d.ts +62 -0
  126. package/dist/module-manager.js +350 -0
  127. package/dist/module-manager.js.map +1 -0
  128. package/dist/permissions/action-guard.d.ts +28 -0
  129. package/dist/permissions/action-guard.js +61 -0
  130. package/dist/permissions/action-guard.js.map +1 -0
  131. package/dist/project-settings.d.ts +42 -0
  132. package/dist/project-settings.js +120 -0
  133. package/dist/project-settings.js.map +1 -0
  134. package/dist/resources/array-handler.d.ts +28 -0
  135. package/dist/resources/array-handler.js +116 -0
  136. package/dist/resources/array-handler.js.map +1 -0
  137. package/dist/resources/card-type-resource.d.ts +72 -0
  138. package/dist/resources/card-type-resource.js +334 -0
  139. package/dist/resources/card-type-resource.js.map +1 -0
  140. package/dist/resources/create-defaults.d.ts +81 -0
  141. package/dist/resources/create-defaults.js +184 -0
  142. package/dist/resources/create-defaults.js.map +1 -0
  143. package/dist/resources/field-type-resource.d.ts +88 -0
  144. package/dist/resources/field-type-resource.js +411 -0
  145. package/dist/resources/field-type-resource.js.map +1 -0
  146. package/dist/resources/file-resource.d.ts +50 -0
  147. package/dist/resources/file-resource.js +301 -0
  148. package/dist/resources/file-resource.js.map +1 -0
  149. package/dist/resources/folder-resource.d.ts +66 -0
  150. package/dist/resources/folder-resource.js +100 -0
  151. package/dist/resources/folder-resource.js.map +1 -0
  152. package/dist/resources/graph-model-resource.d.ts +78 -0
  153. package/dist/resources/graph-model-resource.js +164 -0
  154. package/dist/resources/graph-model-resource.js.map +1 -0
  155. package/dist/resources/graph-view-resource.d.ts +78 -0
  156. package/dist/resources/graph-view-resource.js +163 -0
  157. package/dist/resources/graph-view-resource.js.map +1 -0
  158. package/dist/resources/link-type-resource.d.ts +62 -0
  159. package/dist/resources/link-type-resource.js +150 -0
  160. package/dist/resources/link-type-resource.js.map +1 -0
  161. package/dist/resources/report-resource.d.ts +77 -0
  162. package/dist/resources/report-resource.js +171 -0
  163. package/dist/resources/report-resource.js.map +1 -0
  164. package/dist/resources/resource-object.d.ts +108 -0
  165. package/dist/resources/resource-object.js +147 -0
  166. package/dist/resources/resource-object.js.map +1 -0
  167. package/dist/resources/template-resource.d.ts +82 -0
  168. package/dist/resources/template-resource.js +173 -0
  169. package/dist/resources/template-resource.js.map +1 -0
  170. package/dist/resources/workflow-resource.d.ts +67 -0
  171. package/dist/resources/workflow-resource.js +156 -0
  172. package/dist/resources/workflow-resource.js.map +1 -0
  173. package/dist/types/queries.d.ts +142 -0
  174. package/dist/types/queries.js +16 -0
  175. package/dist/types/queries.js.map +1 -0
  176. package/dist/utils/card-utils.d.ts +34 -0
  177. package/dist/utils/card-utils.js +78 -0
  178. package/dist/utils/card-utils.js.map +1 -0
  179. package/dist/utils/clingo-fact-builder.d.ts +58 -0
  180. package/dist/utils/clingo-fact-builder.js +126 -0
  181. package/dist/utils/clingo-fact-builder.js.map +1 -0
  182. package/dist/utils/clingo-facts.d.ts +97 -0
  183. package/dist/utils/clingo-facts.js +352 -0
  184. package/dist/utils/clingo-facts.js.map +1 -0
  185. package/dist/utils/clingo-parser.d.ts +59 -0
  186. package/dist/utils/clingo-parser.js +403 -0
  187. package/dist/utils/clingo-parser.js.map +1 -0
  188. package/dist/utils/clingo-program-builder.d.ts +39 -0
  189. package/dist/utils/clingo-program-builder.js +57 -0
  190. package/dist/utils/clingo-program-builder.js.map +1 -0
  191. package/dist/utils/common-utils.d.ts +24 -0
  192. package/dist/utils/common-utils.js +47 -0
  193. package/dist/utils/common-utils.js.map +1 -0
  194. package/dist/utils/constants.d.ts +18 -0
  195. package/dist/utils/constants.js +27 -0
  196. package/dist/utils/constants.js.map +1 -0
  197. package/dist/utils/csv.d.ts +18 -0
  198. package/dist/utils/csv.js +45 -0
  199. package/dist/utils/csv.js.map +1 -0
  200. package/dist/utils/file-utils.d.ts +69 -0
  201. package/dist/utils/file-utils.js +158 -0
  202. package/dist/utils/file-utils.js.map +1 -0
  203. package/dist/utils/json.d.ts +61 -0
  204. package/dist/utils/json.js +108 -0
  205. package/dist/utils/json.js.map +1 -0
  206. package/dist/utils/lexorank.d.ts +59 -0
  207. package/dist/utils/lexorank.js +159 -0
  208. package/dist/utils/lexorank.js.map +1 -0
  209. package/dist/utils/log-utils.d.ts +40 -0
  210. package/dist/utils/log-utils.js +109 -0
  211. package/dist/utils/log-utils.js.map +1 -0
  212. package/dist/utils/random.d.ts +19 -0
  213. package/dist/utils/random.js +34 -0
  214. package/dist/utils/random.js.map +1 -0
  215. package/dist/utils/resource-utils.d.ts +45 -0
  216. package/dist/utils/resource-utils.js +137 -0
  217. package/dist/utils/resource-utils.js.map +1 -0
  218. package/dist/utils/sanitize-svg.d.ts +18 -0
  219. package/dist/utils/sanitize-svg.js +38 -0
  220. package/dist/utils/sanitize-svg.js.map +1 -0
  221. package/dist/utils/user-preferences.d.ts +64 -0
  222. package/dist/utils/user-preferences.js +106 -0
  223. package/dist/utils/user-preferences.js.map +1 -0
  224. package/dist/utils/validate.d.ts +26 -0
  225. package/dist/utils/validate.js +53 -0
  226. package/dist/utils/validate.js.map +1 -0
  227. package/dist/utils/value-utils.d.ts +58 -0
  228. package/dist/utils/value-utils.js +181 -0
  229. package/dist/utils/value-utils.js.map +1 -0
  230. package/package.json +67 -0
  231. package/src/card-metadata-updater.ts +182 -0
  232. package/src/command-handler.ts +686 -0
  233. package/src/command-manager.ts +99 -0
  234. package/src/commands/calculate.ts +591 -0
  235. package/src/commands/create.ts +559 -0
  236. package/src/commands/edit.ts +123 -0
  237. package/src/commands/export-site.ts +356 -0
  238. package/src/commands/export.ts +315 -0
  239. package/src/commands/import.ts +169 -0
  240. package/src/commands/index.ts +42 -0
  241. package/src/commands/move.ts +451 -0
  242. package/src/commands/remove.ts +244 -0
  243. package/src/commands/rename.ts +378 -0
  244. package/src/commands/show.ts +442 -0
  245. package/src/commands/transition.ts +127 -0
  246. package/src/commands/update.ts +76 -0
  247. package/src/commands/validate.ts +962 -0
  248. package/src/containers/card-container.ts +378 -0
  249. package/src/containers/project/project-paths.ts +127 -0
  250. package/src/containers/project/resource-collector.ts +379 -0
  251. package/src/containers/project.ts +1135 -0
  252. package/src/containers/template.ts +573 -0
  253. package/src/exceptions/index.ts +29 -0
  254. package/src/index.ts +33 -0
  255. package/src/interfaces/adoc.ts +18 -0
  256. package/src/interfaces/macros.ts +54 -0
  257. package/src/interfaces/project-interfaces.ts +208 -0
  258. package/src/interfaces/request-status-interfaces.ts +30 -0
  259. package/src/interfaces/resource-interfaces.ts +179 -0
  260. package/src/macros/base-macro.ts +176 -0
  261. package/src/macros/common.ts +24 -0
  262. package/src/macros/createCards/index.ts +57 -0
  263. package/src/macros/createCards/metadata.ts +21 -0
  264. package/src/macros/graph/index.ts +130 -0
  265. package/src/macros/graph/metadata.ts +21 -0
  266. package/src/macros/index.ts +321 -0
  267. package/src/macros/report/index.ts +88 -0
  268. package/src/macros/report/metadata.ts +21 -0
  269. package/src/macros/scoreCard/index.ts +55 -0
  270. package/src/macros/scoreCard/metadata.ts +21 -0
  271. package/src/macros/task-queue.ts +79 -0
  272. package/src/module-manager.ts +443 -0
  273. package/src/permissions/action-guard.ts +77 -0
  274. package/src/project-settings.ts +140 -0
  275. package/src/resources/array-handler.ts +141 -0
  276. package/src/resources/card-type-resource.ts +455 -0
  277. package/src/resources/create-defaults.ts +216 -0
  278. package/src/resources/field-type-resource.ts +533 -0
  279. package/src/resources/file-resource.ts +433 -0
  280. package/src/resources/folder-resource.ts +140 -0
  281. package/src/resources/graph-model-resource.ts +205 -0
  282. package/src/resources/graph-view-resource.ts +199 -0
  283. package/src/resources/link-type-resource.ts +191 -0
  284. package/src/resources/report-resource.ts +224 -0
  285. package/src/resources/resource-object.ts +246 -0
  286. package/src/resources/template-resource.ts +210 -0
  287. package/src/resources/workflow-resource.ts +205 -0
  288. package/src/types/queries.ts +149 -0
  289. package/src/utils/card-utils.ts +83 -0
  290. package/src/utils/clingo-fact-builder.ts +167 -0
  291. package/src/utils/clingo-facts.ts +550 -0
  292. package/src/utils/clingo-parser.ts +519 -0
  293. package/src/utils/clingo-program-builder.ts +71 -0
  294. package/src/utils/common-utils.ts +54 -0
  295. package/src/utils/constants.ts +32 -0
  296. package/src/utils/csv.ts +53 -0
  297. package/src/utils/file-utils.ts +182 -0
  298. package/src/utils/json.ts +118 -0
  299. package/src/utils/lexorank.ts +180 -0
  300. package/src/utils/log-utils.ts +127 -0
  301. package/src/utils/random.ts +37 -0
  302. package/src/utils/resource-utils.ts +180 -0
  303. package/src/utils/sanitize-svg.ts +46 -0
  304. package/src/utils/user-preferences.ts +126 -0
  305. package/src/utils/validate.ts +66 -0
  306. package/src/utils/value-utils.ts +189 -0
@@ -0,0 +1,159 @@
1
+ /**
2
+ Cyberismo
3
+ Copyright © Cyberismo Ltd and contributors 2024
4
+
5
+ This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License version 3 as published by the Free Software Foundation.
6
+
7
+ This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.
8
+
9
+ You should have received a copy of the GNU Affero General Public
10
+ License along with this program. If not, see <https://www.gnu.org/licenses/>.
11
+ */
12
+ const ALPHABET = 'abcdefghijklmnopqrstuvwxyz';
13
+ const ALPHABET_SIZE = ALPHABET.length;
14
+ const PREFIX = '0|'; // prefix to allow easy addition of buckets later if required
15
+ export const FIRST_RANK = PREFIX + ALPHABET[0];
16
+ export const LAST_RANK = PREFIX + ALPHABET[ALPHABET_SIZE - 1];
17
+ export const EMPTY_RANK = `1|${ALPHABET[0]}`; // rank to be used when no rank is available
18
+ /**
19
+ * Convert a number to base 26
20
+ * @param num number to convert to base 26
21
+ * @returns the string representation of the number in base 26
22
+ */
23
+ export function enbase(num) {
24
+ if (num === 0)
25
+ return ALPHABET[0];
26
+ let result = '';
27
+ while (num > 0) {
28
+ result =
29
+ String.fromCharCode(ALPHABET.charCodeAt(0) + (num % ALPHABET_SIZE)) +
30
+ result;
31
+ num = Math.floor(num / ALPHABET_SIZE);
32
+ }
33
+ return result;
34
+ }
35
+ /**
36
+ * Convert a rank to a number
37
+ * @param str rank to convert to a number
38
+ * @returns the number representation of the rank
39
+ */
40
+ export function debase(str) {
41
+ let result = 0;
42
+ for (let i = 0; i < str.length; i++) {
43
+ result +=
44
+ (str.charCodeAt(i) - ALPHABET.charCodeAt(0)) *
45
+ Math.pow(ALPHABET_SIZE, str.length - i - 1);
46
+ }
47
+ return result;
48
+ }
49
+ /**
50
+ * Returns the next available rank after the given rank
51
+ * @param rank rank to get the next rank after
52
+ * @returns the next available rank after the given rank
53
+ */
54
+ export function getRankAfter(rank) {
55
+ rank = rank.replace(PREFIX, '');
56
+ let num = debase(rank);
57
+ num++;
58
+ const newRank = enbase(num);
59
+ if (newRank.length > rank.length) {
60
+ return PREFIX + rank + ALPHABET[ALPHABET_SIZE / 2];
61
+ }
62
+ return PREFIX + newRank;
63
+ }
64
+ /**
65
+ * Returns the previous available rank before the given rank
66
+ * if the rank is already the first rank, it throws an error
67
+ * @param rank rank to get the previous rank before
68
+ * @returns the previous available rank before the given rank
69
+ */
70
+ export function getRankBefore(rank) {
71
+ rank = rank.replace(PREFIX, '');
72
+ let num = debase(rank);
73
+ num--;
74
+ if (num < 0) {
75
+ throw new Error('Rank cannot be negative');
76
+ }
77
+ return PREFIX + enbase(num);
78
+ }
79
+ /**
80
+ * Get the rank between two ranks
81
+ * Rank is a string that represents a number in base 26
82
+ * Rank must be a string of lowercase letters
83
+ * @param rank1 first rank
84
+ * @param rank2 second rank
85
+ * @returns the rank between the two ranks
86
+ */
87
+ export function getRankBetween(rank1, rank2) {
88
+ // must be padded for the comparison
89
+ rank1 = rank1.replace(PREFIX, '');
90
+ rank2 = rank2.replace(PREFIX, '');
91
+ const length = Math.max(rank1.length, rank2.length);
92
+ // padding with 'a' to make the ranks equal length
93
+ // since comparison is done lexicographically
94
+ // it does not effect the comparison
95
+ const paddedRank1 = rank1.padEnd(length, ALPHABET[0]);
96
+ const paddedRank2 = rank2.padEnd(length, ALPHABET[0]);
97
+ const num1 = debase(paddedRank1);
98
+ const num2 = debase(paddedRank2);
99
+ if (num1 >= num2) {
100
+ throw new Error('Rank1 must be smaller than rank2');
101
+ }
102
+ const res = enbase(Math.floor((num1 + num2) / 2)).padStart(length, ALPHABET[0]);
103
+ if (res !== paddedRank1 && res !== paddedRank2) {
104
+ return PREFIX + res;
105
+ }
106
+ return PREFIX + res + ALPHABET[ALPHABET_SIZE / 2];
107
+ }
108
+ /**
109
+ * Rebalance the ranks so that the distance between each rank is equal
110
+ * @param rankAmount number of ranks to rebalance
111
+ * @returns rebalanced ranks
112
+ */
113
+ export function rebalanceRanks(rankAmount) {
114
+ if (rankAmount === 0)
115
+ return [];
116
+ if (rankAmount === 1)
117
+ return [FIRST_RANK];
118
+ const requiredLevels = Math.ceil(Math.log(rankAmount) / Math.log(ALPHABET_SIZE));
119
+ // set minumum rank consisting of all 'a's and maximum rank consisting of all 'z's
120
+ const minRank = ALPHABET[0].repeat(requiredLevels);
121
+ const maxRank = ALPHABET[ALPHABET_SIZE - 1].repeat(requiredLevels);
122
+ // step size determines the distance between each rank
123
+ const stepSize = Math.floor(debase(maxRank) / (rankAmount - 1));
124
+ const ranks = [];
125
+ for (let i = 0; i < rankAmount; i++) {
126
+ if (i === 0) {
127
+ ranks.push(PREFIX + minRank);
128
+ }
129
+ else if (i === rankAmount - 1) {
130
+ ranks.push(PREFIX + maxRank);
131
+ }
132
+ else {
133
+ const rank = debase(minRank) + stepSize * i;
134
+ ranks.push(PREFIX + enbase(rank));
135
+ }
136
+ }
137
+ return ranks;
138
+ }
139
+ /**
140
+ * Sort items based on lexorank
141
+ * @param items items to sort
142
+ * @param rankGetter should return the lexorank of the item
143
+ * @returns sorted items
144
+ */
145
+ export function sortItems(items, rankGetter) {
146
+ if (items.length === 0)
147
+ return items;
148
+ return items.sort((a, b) => compare(rankGetter(a), rankGetter(b)));
149
+ }
150
+ /**
151
+ * default compare function
152
+ * @param a first string
153
+ * @param b second string
154
+ * @returns -1 if a < b, 0 if a === b, 1 if a > b
155
+ */
156
+ export function compare(a, b) {
157
+ return a.localeCompare(b);
158
+ }
159
+ //# sourceMappingURL=lexorank.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"lexorank.js","sourceRoot":"","sources":["../../src/utils/lexorank.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;EAUE;AACF,MAAM,QAAQ,GAAG,4BAA4B,CAAC;AAC9C,MAAM,aAAa,GAAG,QAAQ,CAAC,MAAM,CAAC;AAEtC,MAAM,MAAM,GAAG,IAAI,CAAC,CAAC,6DAA6D;AAElF,MAAM,CAAC,MAAM,UAAU,GAAG,MAAM,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC;AAC/C,MAAM,CAAC,MAAM,SAAS,GAAG,MAAM,GAAG,QAAQ,CAAC,aAAa,GAAG,CAAC,CAAC,CAAC;AAE9D,MAAM,CAAC,MAAM,UAAU,GAAG,KAAK,QAAQ,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,4CAA4C;AAI1F;;;;GAIG;AACH,MAAM,UAAU,MAAM,CAAC,GAAW;IAChC,IAAI,GAAG,KAAK,CAAC;QAAE,OAAO,QAAQ,CAAC,CAAC,CAAC,CAAC;IAElC,IAAI,MAAM,GAAG,EAAE,CAAC;IAChB,OAAO,GAAG,GAAG,CAAC,EAAE,CAAC;QACf,MAAM;YACJ,MAAM,CAAC,YAAY,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,GAAG,aAAa,CAAC,CAAC;gBACnE,MAAM,CAAC;QACT,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,GAAG,aAAa,CAAC,CAAC;IACxC,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,MAAM,CAAC,GAAW;IAChC,IAAI,MAAM,GAAG,CAAC,CAAC;IACf,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,GAAG,CA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AAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC,CAAC,EAAE,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AACrE,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,OAAO,CAAC,CAAS,EAAE,CAAS;IAC1C,OAAO,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC;AAC5B,CAAC"}
@@ -0,0 +1,40 @@
1
+ /**
2
+ Cyberismo
3
+ Copyright © Cyberismo Ltd and contributors 2024
4
+
5
+ This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License version 3 as published by the Free Software Foundation.
6
+
7
+ This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.
8
+
9
+ You should have received a copy of the GNU Affero General Public
10
+ License along with this program. If not, see <https://www.gnu.org/licenses/>.
11
+ */
12
+ import pino from 'pino';
13
+ export declare const logger: pino.Logger<never, boolean>;
14
+ /**
15
+ * Returns error message string from an Error object.
16
+ * @param error Error object
17
+ * @returns Error message.
18
+ */
19
+ export declare function errorFunction(error: unknown): string;
20
+ /**
21
+ * Same as 'errorFunction' but can do automatic replacement fof the error message string.
22
+ * @param message Error message
23
+ * @param toReplace replacement substring
24
+ * @param replaceWith string that 'toReplace' is replaced with.
25
+ * @returns Modified error message.
26
+ */
27
+ export declare function errorMessage(message: string, toReplace?: string, replaceWith?: string): string;
28
+ /**
29
+ * Logs error from Error object.
30
+ * @param error potentially an Error object. When exceptions are raised, they are typically Error objects.
31
+ */
32
+ export declare function logError(error: unknown): void;
33
+ /**
34
+ * Log error message in RED. Certain parts of messages can be replaced.
35
+ * This is useful, if including a message from external sources, and want to reduce the verbosity of the message.
36
+ * @param message Error message to log.
37
+ * @param toReplace String to look for.
38
+ * @param replaceWith Replace 'toReplace' with this. Only replaces first instance of 'toReplace'.
39
+ */
40
+ export declare function logErrorMessage(message: string, toReplace?: string, replaceWith?: string): void;
@@ -0,0 +1,109 @@
1
+ /**
2
+ Cyberismo
3
+ Copyright © Cyberismo Ltd and contributors 2024
4
+
5
+ This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License version 3 as published by the Free Software Foundation.
6
+
7
+ This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.
8
+
9
+ You should have received a copy of the GNU Affero General Public
10
+ License along with this program. If not, see <https://www.gnu.org/licenses/>.
11
+ */
12
+ import { join } from 'path';
13
+ import pino from 'pino';
14
+ import { fileURLToPath } from 'url';
15
+ const LOG_FILE_LOCATION = join(fileURLToPath(import.meta.url), '../../../../../logs/data-handler.trace');
16
+ function getLogger() {
17
+ const all = [
18
+ {
19
+ target: 'pino/file',
20
+ options: { destination: LOG_FILE_LOCATION, mkdir: true }, // trace file
21
+ level: 'trace',
22
+ },
23
+ {
24
+ target: 'pino-pretty',
25
+ level: process.env.LOG_LEVEL || 'debug',
26
+ },
27
+ ];
28
+ const [file, stdout] = all;
29
+ if (process.env.NODE_ENV === 'test') {
30
+ // While testing, we simply use stdout and info level by default
31
+ return pino.default({
32
+ level: process.env.LOG_LEVEL || 'info',
33
+ transport: stdout,
34
+ });
35
+ }
36
+ if (process.env.NODE_ENV === 'development') {
37
+ // In dev mode, only stdout and debug logs by default
38
+ return pino.default({
39
+ level: 'trace',
40
+ transport: {
41
+ targets: all,
42
+ },
43
+ });
44
+ }
45
+ return pino.default({
46
+ level: 'trace',
47
+ transport: file,
48
+ });
49
+ }
50
+ export const logger = getLogger();
51
+ /**
52
+ * Returns error message string from an Error object.
53
+ * @param error Error object
54
+ * @returns Error message.
55
+ */
56
+ export function errorFunction(error) {
57
+ if (error instanceof Error) {
58
+ const err = error;
59
+ return errorMessage(`${err.message}`);
60
+ }
61
+ else if (typeof error === 'string') {
62
+ return errorMessage(`${error}`);
63
+ }
64
+ else {
65
+ return `${logError.name} called without an error object. Actual object is ${JSON.stringify(error)}`;
66
+ }
67
+ }
68
+ /**
69
+ * Same as 'errorFunction' but can do automatic replacement fof the error message string.
70
+ * @param message Error message
71
+ * @param toReplace replacement substring
72
+ * @param replaceWith string that 'toReplace' is replaced with.
73
+ * @returns Modified error message.
74
+ */
75
+ export function errorMessage(message, toReplace, replaceWith) {
76
+ let errorMessage = message;
77
+ if (toReplace && replaceWith) {
78
+ errorMessage = message.replace(toReplace, replaceWith);
79
+ }
80
+ return `${errorMessage}`;
81
+ }
82
+ /**
83
+ * Logs error from Error object.
84
+ * @param error potentially an Error object. When exceptions are raised, they are typically Error objects.
85
+ */
86
+ export function logError(error) {
87
+ if (error instanceof Error) {
88
+ const err = error;
89
+ logErrorMessage(`${err.message}`);
90
+ }
91
+ else {
92
+ console.error(`${logError.name} called without an error object. Actual object is ${JSON.stringify(error)}`);
93
+ }
94
+ }
95
+ /**
96
+ * Log error message in RED. Certain parts of messages can be replaced.
97
+ * This is useful, if including a message from external sources, and want to reduce the verbosity of the message.
98
+ * @param message Error message to log.
99
+ * @param toReplace String to look for.
100
+ * @param replaceWith Replace 'toReplace' with this. Only replaces first instance of 'toReplace'.
101
+ */
102
+ export function logErrorMessage(message, toReplace, replaceWith) {
103
+ let errorMessage = message;
104
+ if (toReplace && replaceWith) {
105
+ errorMessage = message.replace(toReplace, replaceWith);
106
+ }
107
+ console.error(`${errorMessage}`);
108
+ }
109
+ //# sourceMappingURL=log-utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"log-utils.js","sourceRoot":"","sources":["../../src/utils/log-utils.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;EAUE;AAEF,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAC5B,OAAO,IAAqC,MAAM,MAAM,CAAC;AACzD,OAAO,EAAE,aAAa,EAAE,MAAM,KAAK,CAAC;AACpC,MAAM,iBAA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nC,CAAC"}
@@ -0,0 +1,19 @@
1
+ /**
2
+ Cyberismo
3
+ Copyright © Cyberismo Ltd and contributors 2024
4
+
5
+ This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License version 3 as published by the Free Software Foundation.
6
+
7
+ This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.
8
+
9
+ You should have received a copy of the GNU Affero General Public
10
+ License along with this program. If not, see <https://www.gnu.org/licenses/>.
11
+ */
12
+ /**
13
+ * Returns a random string in given base with given length.
14
+ * @param base which base to be used, e.g. 36 for base-36, must be an integer
15
+ * @param length length of string, must be an integer
16
+ * @returns a random string
17
+ * @throws if parameters are not integer numbers
18
+ */
19
+ export declare function generateRandomString(base: number, length: number): string;
@@ -0,0 +1,34 @@
1
+ /**
2
+ Cyberismo
3
+ Copyright © Cyberismo Ltd and contributors 2024
4
+
5
+ This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License version 3 as published by the Free Software Foundation.
6
+
7
+ This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.
8
+
9
+ You should have received a copy of the GNU Affero General Public
10
+ License along with this program. If not, see <https://www.gnu.org/licenses/>.
11
+ */
12
+ import { randomInt } from 'node:crypto';
13
+ // Maximum base for randomInt.
14
+ const MAX_VALUE = Math.pow(2, 48) - 1;
15
+ /**
16
+ * Returns a random string in given base with given length.
17
+ * @param base which base to be used, e.g. 36 for base-36, must be an integer
18
+ * @param length length of string, must be an integer
19
+ * @returns a random string
20
+ * @throws if parameters are not integer numbers
21
+ */
22
+ export function generateRandomString(base, length) {
23
+ if (!Number.isInteger(base) || !Number.isInteger(length)) {
24
+ throw new Error('parameters must be integers');
25
+ }
26
+ // Generate a random number between 0 and given base max number - 1
27
+ const maxBaseNumber = Math.min(MAX_VALUE, Math.pow(base, length));
28
+ let generatedString = '';
29
+ while (generatedString.length < length) {
30
+ generatedString += randomInt(maxBaseNumber).toString(base);
31
+ }
32
+ return generatedString.substring(0, length);
33
+ }
34
+ //# sourceMappingURL=random.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"random.js","sourceRoot":"","sources":["../../src/utils/random.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;EAUE;AAEF,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAExC,8BAA8B;AAC9B,MAAM,SAAS,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,CAAC,CAAC;AAEtC;;;;;;GAMG;AACH,MAAM,UAAU,oBAAoB,CAAC,IAAY,EAAE,MAAc;IAC/D,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,MAAM,CAAC,EAAE,CAAC;QACzD,MAAM,IAAI,KAAK,CAAC,6BAA6B,CAAC,CAAC;IACjD,CAAC;IAED,mEAAmE;IACnE,MAAM,aAAa,GAAG,IAAI,CAAC,GAAG,CAAC,SAAS,EAAE,IAAI,CAAC,GAAG,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC,CAAC;IAClE,IAAI,eAAe,GAAG,EAAE,CAAC;IACzB,OAAO,eAAe,CAAC,MAAM,GAAG,MAAM,EAAE,CAAC;QACvC,eAAe,IAAI,SAAS,CAAC,aAAa,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;IAC7D,CAAC;IACD,OAAO,eAAe,CAAC,SAAS,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC;AAC9C,CAAC"}
@@ -0,0 +1,45 @@
1
+ /**
2
+ Cyberismo
3
+ Copyright © Cyberismo Ltd and contributors 2024
4
+ This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License version 3 as published by the Free Software Foundation.
5
+ This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.
6
+ You should have received a copy of the GNU Affero General Public
7
+ License along with this program. If not, see <https://www.gnu.org/licenses/>.
8
+ */
9
+ import type { Project } from '../containers/project.js';
10
+ export interface ResourceName {
11
+ prefix: string;
12
+ type: string;
13
+ identifier: string;
14
+ }
15
+ export declare function isResourceName(name: string): boolean;
16
+ /**
17
+ * Returns resource name parts (project prefix, type in plural, name of the resource).
18
+ * @param resourceName Name of the resource (e.g. <prefix>/<type>/<name>)
19
+ * @param strict If true, does not allow names without 'prefix' and 'type'.
20
+ * @throws if 'resourceName' is not valid resource name.
21
+ * @returns resource name parts: project or module prefix, resource type (plural) and actual name of the resource.
22
+ * @todo: In the future, switch the default value of 'strict' to true. Only in certain cases should we accept names with just 'identifier'.
23
+ */
24
+ export declare function resourceName(resourceName: string, strict?: boolean): ResourceName;
25
+ /**
26
+ * Converts resource name to path.
27
+ * @param project Project
28
+ * @param resourceName Name of the resource (e.g. <prefix>/<type>/<name>)
29
+ * @returns path to resource metadata file
30
+ */
31
+ export declare function resourceNameToPath(project: Project, resourceName: ResourceName): string;
32
+ /**
33
+ * Resource metadata file path to resource name (e.g. <prefix>/<type>/<name>)
34
+ * @param project Project where resource is in
35
+ * @param path Path to resource metadata file
36
+ * @returns Resource name (<prefix>/<type>/<name>)
37
+ */
38
+ export declare function pathToResourceName(project: Project, path: string): ResourceName;
39
+ /**
40
+ * Returns ResourceName as a single string.
41
+ * @param resourceName Resource name to convert.
42
+ * @returns resource name as a single string.
43
+ * @note that valid resource names are: empty string, identifier alone and prefix/type/identifier combination.
44
+ */
45
+ export declare function resourceNameToString(resourceName: ResourceName): string;
@@ -0,0 +1,137 @@
1
+ /**
2
+ Cyberismo
3
+ Copyright © Cyberismo Ltd and contributors 2024
4
+ This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License version 3 as published by the Free Software Foundation.
5
+ This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.
6
+ You should have received a copy of the GNU Affero General Public
7
+ License along with this program. If not, see <https://www.gnu.org/licenses/>.
8
+ */
9
+ // node
10
+ import { join, parse, sep } from 'node:path';
11
+ import { stripExtension } from './file-utils.js';
12
+ // Indexes of resource name parts
13
+ const PREFIX_INDEX = 0;
14
+ const TYPE_INDEX = 1;
15
+ const IDENTIFIER_INDEX = 2;
16
+ // Valid resource name has three parts
17
+ const RESOURCE_NAME_PARTS = 3;
18
+ // Checks if name is valid (3 parts, separated by '/').
19
+ export function isResourceName(name) {
20
+ const partsCount = name.split('/').length;
21
+ return partsCount === RESOURCE_NAME_PARTS;
22
+ }
23
+ /**
24
+ * Returns resource name parts (project prefix, type in plural, name of the resource).
25
+ * @param resourceName Name of the resource (e.g. <prefix>/<type>/<name>)
26
+ * @param strict If true, does not allow names without 'prefix' and 'type'.
27
+ * @throws if 'resourceName' is not valid resource name.
28
+ * @returns resource name parts: project or module prefix, resource type (plural) and actual name of the resource.
29
+ * @todo: In the future, switch the default value of 'strict' to true. Only in certain cases should we accept names with just 'identifier'.
30
+ */
31
+ export function resourceName(resourceName, strict = false) {
32
+ const parts = resourceName.split('/');
33
+ // just resource identifier - type and prefix are unknown
34
+ if (parts.length === 1 && parts.at(0) !== '') {
35
+ if (strict) {
36
+ throw new Error(`Name '${resourceName}' is not valid resource name`);
37
+ }
38
+ return {
39
+ prefix: '',
40
+ type: '',
41
+ identifier: resourceName,
42
+ };
43
+ }
44
+ // resource name
45
+ if (parts.length === RESOURCE_NAME_PARTS) {
46
+ return {
47
+ prefix: parts[PREFIX_INDEX],
48
+ type: parts[TYPE_INDEX],
49
+ identifier: parse(parts[IDENTIFIER_INDEX]).name,
50
+ };
51
+ }
52
+ // other formats are not accepted
53
+ if (resourceName === '') {
54
+ throw new Error('Must define resource name to query its details');
55
+ }
56
+ throw new Error(`Name '${resourceName}' is not valid resource name`);
57
+ }
58
+ /**
59
+ * Converts resource name to path.
60
+ * @param project Project
61
+ * @param resourceName Name of the resource (e.g. <prefix>/<type>/<name>)
62
+ * @returns path to resource metadata file
63
+ */
64
+ export function resourceNameToPath(project, resourceName) {
65
+ if (project.projectPrefix === resourceName.prefix) {
66
+ return join(project.paths.resourcesFolder, resourceName.type, resourceName.identifier + '.json');
67
+ }
68
+ else if (resourceName.prefix !== '') {
69
+ return join(project.paths.modulesFolder, resourceName.prefix, resourceName.type, resourceName.identifier + '.json');
70
+ }
71
+ throw new Error('resourceName does not contain prefix');
72
+ }
73
+ /**
74
+ * Resource metadata file path to resource name (e.g. <prefix>/<type>/<name>)
75
+ * @param project Project where resource is in
76
+ * @param path Path to resource metadata file
77
+ * @returns Resource name (<prefix>/<type>/<name>)
78
+ */
79
+ export function pathToResourceName(project, path) {
80
+ const parts = path.split(sep);
81
+ const modulesIndex = parts.lastIndexOf('modules');
82
+ const localIndex = parts.lastIndexOf('local');
83
+ // Check that either 'local' or 'modules' is included in path (but not both).
84
+ // And after that there is required amount of parts.
85
+ if ((modulesIndex === -1 && localIndex === -1) ||
86
+ (modulesIndex !== -1 && localIndex !== -1) ||
87
+ (modulesIndex !== -1 &&
88
+ localIndex === 1 &&
89
+ parts.length === modulesIndex + 3) ||
90
+ (modulesIndex === -1 &&
91
+ localIndex !== -1 &&
92
+ parts.length === localIndex + 2)) {
93
+ throw new Error(`invalid path: ${path}`);
94
+ }
95
+ // Finally check that all relevant parts are defined.
96
+ const prefix = modulesIndex !== -1 ? parts.at(modulesIndex + 1) : project.projectPrefix;
97
+ const typeIndex = modulesIndex !== -1 ? modulesIndex + 2 : localIndex + 1;
98
+ const identifierIndex = modulesIndex !== -1 ? modulesIndex + 3 : localIndex + 2;
99
+ const type = parts.at(typeIndex);
100
+ const identifier = stripExtension(parts.at(identifierIndex));
101
+ if (!identifier || !type || !prefix) {
102
+ throw new Error(`invalid path: ${path}`);
103
+ }
104
+ return {
105
+ prefix: prefix,
106
+ type: type,
107
+ identifier: identifier,
108
+ };
109
+ }
110
+ /**
111
+ * Returns ResourceName as a single string.
112
+ * @param resourceName Resource name to convert.
113
+ * @returns resource name as a single string.
114
+ * @note that valid resource names are: empty string, identifier alone and prefix/type/identifier combination.
115
+ */
116
+ export function resourceNameToString(resourceName) {
117
+ if (!resourceName.prefix && !resourceName.type && !resourceName.identifier) {
118
+ return '';
119
+ }
120
+ if (resourceName.identifier === '') {
121
+ throw new Error(`Not a valid resource name. Identifier is missing.`);
122
+ }
123
+ if (resourceName.prefix &&
124
+ resourceName.identifier &&
125
+ resourceName.type === '') {
126
+ throw new Error(`Not a valid resource name. Type is missing.`);
127
+ }
128
+ if (resourceName.prefix === '' &&
129
+ resourceName.identifier &&
130
+ resourceName.type) {
131
+ throw new Error(`Not a valid resource name. Prefix is missing.`);
132
+ }
133
+ return resourceName.prefix && resourceName.type && resourceName.prefix
134
+ ? `${resourceName.prefix}/${resourceName.type}/${resourceName.identifier}`
135
+ : `${resourceName.identifier}`;
136
+ }
137
+ //# sourceMappingURL=resource-utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resource-utils.js","sourceRoot":"","sources":["../../src/utils/resource-utils.ts"],"names":[],"mappings":"AAAA;;;;;;;EAOE;AAEF,OAAO;AACP,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,EAAE,MAAM,WAAW,CAAC;AAG7C,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAYjD,iCAAiC;AACjC,MAAM,YAAY,GAAG,CAAC,CAAC;AACvB,MAAM,UAAU,GAAG,CAAC,CAAC;AACrB,MAAM,gBAAgB,GAAG,CAAC,CAAC;AAC3B,sCAAsC;AACtC,MAAM,mBAAmB,GAAG,CAAC,CAAC;AAE9B,uDAAuD;AACvD,MAAM,UAAU,cAAc,CAAC,IAAY;IACzC,MAAM,UAAU,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,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AU;QACvB,YAAY,CAAC,IAAI,EACjB,CAAC;QACD,MAAM,IAAI,KAAK,CAAC,+CAA+C,CAAC,CAAC;IACnE,CAAC;IACD,OAAO,YAAY,CAAC,MAAM,IAAI,YAAY,CAAC,IAAI,IAAI,YAAY,CAAC,MAAM;QACpE,CAAC,CAAC,GAAG,YAAY,CAAC,MAAM,IAAI,YAAY,CAAC,IAAI,IAAI,YAAY,CAAC,UAAU,EAAE;QAC1E,CAAC,CAAC,GAAG,YAAY,CAAC,UAAU,EAAE,CAAC;AACnC,CAAC"}
@@ -0,0 +1,18 @@
1
+ /**
2
+ Cyberismo
3
+ Copyright © Cyberismo Ltd and contributors 2024
4
+
5
+ This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License version 3 as published by the Free Software Foundation.
6
+
7
+ This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.
8
+
9
+ You should have received a copy of the GNU Affero General Public
10
+ License along with this program. If not, see <https://www.gnu.org/licenses/>.
11
+ */
12
+ import { Buffer } from 'buffer';
13
+ /**
14
+ * Sanitize an SVG Buffer and return a base64-encoded string
15
+ * @param buffer - SVG content as a Buffer
16
+ * @returns base64-encoded sanitized SVG string
17
+ */
18
+ export declare function sanitizeSvgBase64(buffer: Buffer): string;
@@ -0,0 +1,38 @@
1
+ /**
2
+ Cyberismo
3
+ Copyright © Cyberismo Ltd and contributors 2024
4
+
5
+ This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License version 3 as published by the Free Software Foundation.
6
+
7
+ This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.
8
+
9
+ You should have received a copy of the GNU Affero General Public
10
+ License along with this program. If not, see <https://www.gnu.org/licenses/>.
11
+ */
12
+ import createDOMPurify from 'dompurify';
13
+ import { Buffer } from 'buffer';
14
+ import { JSDOM } from 'jsdom';
15
+ const window = new JSDOM('').window;
16
+ // Remove SVG size to make it scale in the application properly
17
+ const removeSvgWidthAndHeight = (node) => {
18
+ if (node.nodeName === 'svg') {
19
+ node.removeAttribute('width');
20
+ node.removeAttribute('height');
21
+ }
22
+ };
23
+ /**
24
+ * Sanitize an SVG Buffer and return a base64-encoded string
25
+ * @param buffer - SVG content as a Buffer
26
+ * @returns base64-encoded sanitized SVG string
27
+ */
28
+ export function sanitizeSvgBase64(buffer) {
29
+ const DOMPurify = createDOMPurify(window);
30
+ const dirty = buffer.toString('utf-8');
31
+ DOMPurify.setConfig({ USE_PROFILES: { svg: true } });
32
+ DOMPurify.addHook('afterSanitizeAttributes', removeSvgWidthAndHeight);
33
+ let cleaned = DOMPurify.sanitize(dirty);
34
+ // Remove link titles, quick fix for Clingraph/Graphviz generated titles for links that are quite strange
35
+ cleaned = cleaned.replace(/\s*xlink:title=(["']).*?\1/g, '');
36
+ return Buffer.from(cleaned, 'utf-8').toString('base64');
37
+ }
38
+ //# sourceMappingURL=sanitize-svg.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sanitize-svg.js","sourceRoot":"","sources":["../../src/utils/sanitize-svg.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;EAUE;AAEF,OAAO,eAAoC,MAAM,WAAW,CAAC;AAC7D,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAChC,OAAO,EAAE,KAAK,EAAE,MAAM,OAAO,CAAC;AAE9B,MAAM,MAAM,GAAG,IAAI,KAAK,CAAC,EAAE,CAAC,CAAC,MAA2B,CAAC;AAEzD,+DAA+D;AAC/D,MAAM,uBAAuB,GAAG,CAAC,IAAa,EAAE,EAAE;IAChD,IAAI,IAAI,CAAC,QAAQ,KAAK,KAAK,EAAE,CAAC;QAC5B,IAAI,CAAC,eAAe,CAAC,OAAO,CAAC,CAAC;QAC9B,IAAI,CAAC,eAAe,CAAC,QAAQ,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