@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,403 @@
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
+ * This function reverses the encoding made by the "encodeClingoValue" function
14
+ */
15
+ export function decodeClingoValue(value) {
16
+ return value.replace(/\\([n\\"])/g, (_, char) => {
17
+ if (char === 'n') {
18
+ return '\n';
19
+ }
20
+ return char;
21
+ });
22
+ }
23
+ class ClingoParser {
24
+ keywords = [
25
+ 'queryError',
26
+ 'result',
27
+ 'childResult',
28
+ 'field',
29
+ 'enumField',
30
+ 'listField',
31
+ 'label',
32
+ 'link',
33
+ 'transitionDenied',
34
+ 'movingCardDenied',
35
+ 'deletingCardDenied',
36
+ 'editingFieldDenied',
37
+ 'editingContentDenied',
38
+ 'notification',
39
+ 'policyCheckFailure',
40
+ 'policyCheckSuccess',
41
+ 'order',
42
+ ];
43
+ result = {
44
+ results: [],
45
+ error: null,
46
+ };
47
+ // The queue now stores the parameters instead of functions
48
+ resultQueue = [];
49
+ childResultQueue = [];
50
+ tempResults = {};
51
+ orderQueue = [];
52
+ collections = new Set();
53
+ reset() {
54
+ this.result = {
55
+ results: [],
56
+ error: null,
57
+ };
58
+ this.resultQueue = [];
59
+ this.childResultQueue = [];
60
+ this.tempResults = {};
61
+ this.orderQueue = [];
62
+ this.collections = new Set();
63
+ }
64
+ /**
65
+ * Command handlers for each possible keyword
66
+ * All of them will get parameters as strings
67
+ * You can trust that clingo will always provide the correct number of parameters / types
68
+ */
69
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-function-type
70
+ commandHandlers = {
71
+ queryError: (message, ...params) => {
72
+ this.result.error = `${message}${params.length > 1 ? ` ${params.join(', ')}` : ''}`;
73
+ },
74
+ result: (key) => {
75
+ this.resultQueue.push({ key });
76
+ },
77
+ childResult: (parentKey, childKey, collection) => {
78
+ this.childResultQueue.push({ parentKey, childKey, collection });
79
+ this.collections.add(collection);
80
+ },
81
+ enumField: async (key, fieldName, fieldValue, index, displayValue) => {
82
+ const res = this.getOrInitResult(key);
83
+ const decoded = decodeClingoValue(fieldValue);
84
+ const parsedIndex = parseInt(index, 10);
85
+ res[fieldName] = {
86
+ value: decoded,
87
+ index: parsedIndex,
88
+ displayValue,
89
+ };
90
+ },
91
+ // NOTE: Must be tested in INTDEV-623
92
+ listField: async (key, fieldName, fieldValue, index, displayValue) => {
93
+ const res = this.getOrInitResult(key);
94
+ const decoded = decodeClingoValue(fieldValue);
95
+ if (!res[fieldName] || !Array.isArray(res[fieldName])) {
96
+ res[fieldName] = [];
97
+ }
98
+ const parsedIndex = parseInt(index, 10);
99
+ res[fieldName].push({
100
+ value: decoded,
101
+ index: parsedIndex,
102
+ displayValue,
103
+ });
104
+ },
105
+ field: async (key, fieldName, fieldValue, dataType) => {
106
+ const res = this.getOrInitResult(key);
107
+ const decoded = decodeClingoValue(fieldValue);
108
+ switch (dataType) {
109
+ case 'shortText':
110
+ case 'longText':
111
+ case 'person':
112
+ case 'date':
113
+ case 'dateTime':
114
+ res[fieldName] = decoded;
115
+ break;
116
+ case 'number':
117
+ res[fieldName] = parseFloat(decoded);
118
+ break;
119
+ case 'integer':
120
+ res[fieldName] = parseInt(decoded, 10);
121
+ break;
122
+ case 'boolean':
123
+ res[fieldName] = fieldValue === 'true';
124
+ break;
125
+ }
126
+ },
127
+ label: (key, label) => {
128
+ const res = this.getOrInitResult(key);
129
+ res.labels.push(label);
130
+ },
131
+ link: (key, // key is the card itself
132
+ cardKey, // cardKey is otherCard this is being linked to
133
+ title, linkType, displayName, direction, linkSource, linkDescription) => {
134
+ const res = this.getOrInitResult(key);
135
+ res.links.push({
136
+ key: cardKey,
137
+ linkType,
138
+ displayName,
139
+ linkDescription,
140
+ direction,
141
+ linkSource,
142
+ title,
143
+ });
144
+ },
145
+ transitionDenied: (key, transitionName, errorMessage) => {
146
+ const res = this.getOrInitResult(key);
147
+ res.deniedOperations.transition.push({ transitionName, errorMessage });
148
+ },
149
+ movingCardDenied: (key, errorMessage) => {
150
+ const res = this.getOrInitResult(key);
151
+ res.deniedOperations.move.push({ errorMessage });
152
+ },
153
+ deletingCardDenied: (key, errorMessage) => {
154
+ const res = this.getOrInitResult(key);
155
+ res.deniedOperations.delete.push({ errorMessage });
156
+ },
157
+ editingFieldDenied: (key, fieldName, errorMessage) => {
158
+ const res = this.getOrInitResult(key);
159
+ res.deniedOperations.editField.push({ fieldName, errorMessage });
160
+ },
161
+ editingContentDenied: (key, errorMessage) => {
162
+ const res = this.getOrInitResult(key);
163
+ res.deniedOperations.editContent.push({ errorMessage });
164
+ },
165
+ notification: (key, category, title, message) => {
166
+ const res = this.getOrInitResult(key);
167
+ res.notifications.push({ key, category, title, message });
168
+ },
169
+ policyCheckFailure: (key, category, title, errorMessage, fieldName) => {
170
+ const res = this.getOrInitResult(key);
171
+ res.policyChecks.failures.push({
172
+ category,
173
+ title,
174
+ errorMessage,
175
+ fieldName,
176
+ });
177
+ },
178
+ policyCheckSuccess: (key, category, title) => {
179
+ const res = this.getOrInitResult(key);
180
+ res.policyChecks.successes.push({ category, title });
181
+ },
182
+ order: (level, collection, fieldIndex, field, direction) => {
183
+ const parsedLevel = parseInt(level, 10);
184
+ const parsedFieldIndex = parseInt(fieldIndex, 10);
185
+ this.orderQueue.push({
186
+ level: parsedLevel,
187
+ collection,
188
+ fieldIndex: parsedFieldIndex,
189
+ field,
190
+ direction,
191
+ });
192
+ },
193
+ };
194
+ getOrInitResult(key) {
195
+ if (!this.tempResults[key]) {
196
+ this.tempResults[key] = {
197
+ key,
198
+ labels: [],
199
+ links: [],
200
+ notifications: [],
201
+ policyChecks: { successes: [], failures: [] },
202
+ deniedOperations: {
203
+ transition: [],
204
+ move: [],
205
+ delete: [],
206
+ editField: [],
207
+ editContent: [],
208
+ },
209
+ };
210
+ }
211
+ return this.tempResults[key];
212
+ }
213
+ sortByLevel(results, level = 1, currentCollection) {
214
+ const levelOrders = this.orderQueue
215
+ .filter((order) => order.level === level &&
216
+ (currentCollection ? order.collection === currentCollection : true))
217
+ .sort((a, b) => a.fieldIndex - b.fieldIndex);
218
+ // Apply sorting instructions for this level/collection if any
219
+ if (levelOrders.length > 0) {
220
+ results.sort((a, b) => {
221
+ for (const { field, direction } of levelOrders) {
222
+ const sortOrder = direction === 'ASC' ? -1 : 1;
223
+ const firstValue = this.getComparableValue(a[field]);
224
+ const secondValue = this.getComparableValue(b[field]);
225
+ if (firstValue == null && secondValue == null) {
226
+ continue; // both are null, move on to next field
227
+ }
228
+ else if (firstValue == null) {
229
+ return sortOrder; // first is considered less
230
+ }
231
+ else if (secondValue == null) {
232
+ return -sortOrder; // second is considered less
233
+ }
234
+ // Regular comparison
235
+ if (firstValue < secondValue)
236
+ return sortOrder;
237
+ if (firstValue > secondValue)
238
+ return -sortOrder;
239
+ // if equal, try next field
240
+ }
241
+ // if all fields equal
242
+ return 0;
243
+ });
244
+ }
245
+ // Recursively sort all known child collections
246
+ for (const result of results) {
247
+ for (const childCollection of this.collections) {
248
+ const childResults = result[childCollection];
249
+ if (Array.isArray(childResults)) {
250
+ this.sortByLevel(childResults, level + 1, childCollection);
251
+ }
252
+ }
253
+ }
254
+ }
255
+ getComparableValue(value) {
256
+ if (value == null) {
257
+ return null;
258
+ }
259
+ if (typeof value === 'object' &&
260
+ 'index' in value &&
261
+ typeof value.index === 'number') {
262
+ return value.index;
263
+ }
264
+ if (Array.isArray(value)) {
265
+ const indeces = [];
266
+ for (const item of value) {
267
+ if (item != null &&
268
+ typeof item === 'object' &&
269
+ 'index' in item &&
270
+ typeof item.index === 'number') {
271
+ indeces.push(item.index);
272
+ }
273
+ }
274
+ return Math.min(...indeces);
275
+ }
276
+ return value;
277
+ }
278
+ applyResultProcessing() {
279
+ // Process results and parent-child relationships
280
+ this.resultQueue.forEach(({ key }) => {
281
+ const res = this.getOrInitResult(key);
282
+ this.result.results.push(res); // Here we assume the query is correct and returns the data specified by the query
283
+ });
284
+ this.childResultQueue.forEach(({ parentKey, childKey, collection }) => {
285
+ const parent = this.getOrInitResult(parentKey);
286
+ const child = this.getOrInitResult(childKey);
287
+ if (!parent[collection] || !Array.isArray(parent[collection])) {
288
+ parent[collection] = [];
289
+ }
290
+ parent[collection].push(child);
291
+ });
292
+ this.sortByLevel(this.result.results);
293
+ }
294
+ /**
295
+ * This methods is responsible for converting clingo output to a parsed object
296
+ * @param input clingo input to parse
297
+ * @returns
298
+ */
299
+ async parseInput(input) {
300
+ let position = 0;
301
+ while (position < input.length) {
302
+ const keywordMatch = this.findKeyword(input, position);
303
+ if (!keywordMatch) {
304
+ break;
305
+ }
306
+ const { keyword, endIndex } = keywordMatch;
307
+ position = endIndex;
308
+ const parsed = this.parseArguments(input, position);
309
+ if (parsed) {
310
+ // Apply the command handler with sanitized arguments
311
+ await this.commandHandlers[keyword](...parsed.args);
312
+ position = parsed.endPosition; // move position after the argument closing parenthesis
313
+ }
314
+ }
315
+ this.applyResultProcessing();
316
+ const result = this.result;
317
+ // Reset the parser state
318
+ this.reset();
319
+ return result;
320
+ }
321
+ /**
322
+ * This method finds the next keyword in a string after a specified point
323
+ * @param input The string which it being searched
324
+ * @param start The position from which to start the search from
325
+ * @returns
326
+ */
327
+ findKeyword(input, start) {
328
+ // Create a regex dynamically from the keywords list
329
+ const regex = new RegExp(`(${this.keywords.join('|')})\\(`, 'g');
330
+ // Apply the regex starting from the current position
331
+ regex.lastIndex = start;
332
+ const match = regex.exec(input);
333
+ if (match) {
334
+ return {
335
+ keyword: match[1], // The matched keyword (first capture group)
336
+ startIndex: match.index, // Position of the matched keyword
337
+ endIndex: match.index + match[0].length, // Position after the keyword and opening parenthesis
338
+ };
339
+ }
340
+ return null;
341
+ }
342
+ /**
343
+ * This method is a custom parser, which takes in the whole clingo output and parses the arguments.
344
+ * Note: Do not decode in this function. It will be handled on a higher level.
345
+ * As long as this function returns valid clingo, it has done it's responsibility
346
+ * @param input Clingo output
347
+ * @param position Position of the command being parsed inside the string
348
+ * @returns
349
+ */
350
+ parseArguments(input, position) {
351
+ let currentArg = '';
352
+ const args = [];
353
+ let insideQuote = false;
354
+ // calculates how deep into parenthesis we are
355
+ let insideParanthesis = 0;
356
+ for (let i = position; i < input.length; i++) {
357
+ const char = input[i];
358
+ if (char === '"') {
359
+ if (i !== 0 && input[i - 1] === '\\') {
360
+ currentArg += '"';
361
+ continue;
362
+ }
363
+ if (!insideQuote && insideParanthesis === 0) {
364
+ // We can ignore the chars, which are before a quoted string
365
+ currentArg = '';
366
+ }
367
+ insideQuote = !insideQuote; // Toggle inside/outside quotes
368
+ continue;
369
+ }
370
+ if (char === ',' && !insideQuote) {
371
+ if (insideParanthesis > 0) {
372
+ currentArg += char;
373
+ continue;
374
+ }
375
+ args.push(currentArg);
376
+ currentArg = '';
377
+ insideParanthesis = 0;
378
+ continue;
379
+ }
380
+ if (char === '(' && !insideQuote) {
381
+ if (insideParanthesis === 0) {
382
+ currentArg = '';
383
+ }
384
+ insideParanthesis++;
385
+ }
386
+ if (char === ')' && !insideQuote) {
387
+ if (insideParanthesis-- !== 0) {
388
+ currentArg += char;
389
+ continue;
390
+ }
391
+ args.push(currentArg);
392
+ return {
393
+ args,
394
+ endPosition: i + 1,
395
+ };
396
+ }
397
+ currentArg += char;
398
+ }
399
+ return null; // No valid arguments found
400
+ }
401
+ }
402
+ export default ClingoParser;
403
+ //# sourceMappingURL=clingo-parser.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"clingo-parser.js","sourceRoot":"","sources":["../../src/utils/clingo-parser.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;EAUE;AASF;;GAEG;AACH,MAAM,UAAU,iBAAiB,CAAC,KAAa;IAC7C,OAAO,KAAK,CAAC,OAAO,CAAC,aAAa,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,EAAE;QAC9C,IAAI,IAAI,KAAK,GAAG,EAAE,CAAC;YACjB,OAAO,IAAI,CAAC;QACd,CAAC;QACD,OAAO,IAAI,CAAC;IACd,CAAC,CAAC,CAAC;AACL,CAAC;AAED,MAAM,YAAY;IACR,QAAQ,GAAG;QACjB,YAAY;QACZ,QAAQ;QACR,aAAa;QACb,OAAO;QACP,WAAW;QACX,WAAW;QACX,OAAO;QACP,MAAM;QACN,kBAAkB;QAClB,kBAAkB;QAClB,oBAAoB;QACpB,oBAAoB;QACpB,sBAAsB;QACtB,cAAc;QACd,oBAAoB;QACpB,oBAAoB;QACpB,OAAO;KACR,CAAC;IAEM,MAAM,GAA4B;QACxC,OAAO,EAAE,EAAE;QACX,KAAK,EAAE,IAAI;KACZ,CAAC;IAEF,2DAA2D;IACnD,WAAW,GAAsB,EAAE,CAAC;IACpC,gBAAgB,GAIlB,EAAE,CAAC;IACD,WAAW,GAAkC,EAAE,CAAC;IAChD,UAAU,GAMZ,EAAE,CAAC;IACD,WAAW,GAAgB,IAAI,GAAG,EAAE,CAAC;IACrC,KAAK;QACX,IAAI,CAAC,MAAM,GAAG;YACZ,OAAO,EAAE,EAAE;YACX,KAAK,EAAE,IAAI;SACZ,CAAC;QACF,IAAI,CAAC,WAAW,GAAG,EA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AED,IAAI,IAAI,KAAK,GAAG,IAAI,CAAC,WAAW,EAAE,CAAC;gBACjC,IAAI,iBAAiB,EAAE,KAAK,CAAC,EAAE,CAAC;oBAC9B,UAAU,IAAI,IAAI,CAAC;oBACnB,SAAS;gBACX,CAAC;gBACD,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;gBACtB,OAAO;oBACL,IAAI;oBACJ,WAAW,EAAE,CAAC,GAAG,CAAC;iBACnB,CAAC;YACJ,CAAC;YAED,UAAU,IAAI,IAAI,CAAC;QACrB,CAAC;QAED,OAAO,IAAI,CAAC,CAAC,2BAA2B;IAC1C,CAAC;CACF;AAED,eAAe,YAAY,CAAC"}
@@ -0,0 +1,39 @@
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 { type ClingoArgument, ClingoFactBuilder } from './clingo-fact-builder.js';
13
+ export declare class ClingoProgramBuilder {
14
+ private rows;
15
+ /**
16
+ * Adds a new fact with a simple configuration.
17
+ * @param predicate - The fact's predicate
18
+ * @param args - The fact's arguments
19
+ */
20
+ addFact(predicate: string, ...args: ClingoArgument[]): ClingoProgramBuilder;
21
+ /**
22
+ * Adds a custom fact allowing use of the builder methods directly for more control.
23
+ * @param predicate - The fact's predicate
24
+ * @param configure - Function to configure the fact with builder methods
25
+ */
26
+ addCustomFact(predicate: string, configure: (builder: ClingoFactBuilder) => ClingoFactBuilder): ClingoProgramBuilder;
27
+ /**
28
+ * Adds an import to the clingo program
29
+ */
30
+ addImport(path: string): ClingoProgramBuilder;
31
+ /**
32
+ * Adds a comment
33
+ */
34
+ addComment(comment: string): ClingoProgramBuilder;
35
+ /**
36
+ * Builds all facts and returns them as a single string with each fact on a new line.
37
+ */
38
+ buildAll(): string;
39
+ }
@@ -0,0 +1,57 @@
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 { ClingoFactBuilder, } from './clingo-fact-builder.js';
13
+ export class ClingoProgramBuilder {
14
+ rows = [];
15
+ /**
16
+ * Adds a new fact with a simple configuration.
17
+ * @param predicate - The fact's predicate
18
+ * @param args - The fact's arguments
19
+ */
20
+ addFact(predicate, ...args) {
21
+ const fact = new ClingoFactBuilder(predicate).addArguments(...args);
22
+ this.rows.push(fact);
23
+ return this;
24
+ }
25
+ /**
26
+ * Adds a custom fact allowing use of the builder methods directly for more control.
27
+ * @param predicate - The fact's predicate
28
+ * @param configure - Function to configure the fact with builder methods
29
+ */
30
+ addCustomFact(predicate, configure) {
31
+ const factBuilder = new ClingoFactBuilder(predicate);
32
+ // Allow configuration of the fact
33
+ this.rows.push(configure(factBuilder));
34
+ return this;
35
+ }
36
+ /**
37
+ * Adds an import to the clingo program
38
+ */
39
+ addImport(path) {
40
+ this.rows.push({ build: () => `#include "${path}".` });
41
+ return this;
42
+ }
43
+ /**
44
+ * Adds a comment
45
+ */
46
+ addComment(comment) {
47
+ this.rows.push({ build: () => `% ${comment}` });
48
+ return this;
49
+ }
50
+ /**
51
+ * Builds all facts and returns them as a single string with each fact on a new line.
52
+ */
53
+ buildAll() {
54
+ return this.rows.map((row) => row.build()).join('\n') + '\n';
55
+ }
56
+ }
57
+ //# sourceMappingURL=clingo-program-builder.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"clingo-program-builder.js","sourceRoot":"","sources":["../../src/utils/clingo-program-builder.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;EAUE;AACF,OAAO,EAEL,iBAAiB,GAClB,MAAM,0BAA0B,CAAC;AAMlC,MAAM,OAAO,oBAAoB;IACvB,IAAI,GAAe,EAAE,CAAC;IAE9B;;;;OAIG;IACH,OAAO,CAAC,SAAiB,EAAE,GAAG,IAAsB;QAClD,MAAM,IAAI,GAAG,IAAI,iBAAiB,CAAC,SAAS,CAAC,CAAC,YAAY,CAAC,GAAG,IAAI,CAAC,CAAC;QACpE,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACrB,OAAO,IAAI,CAAC;IACd,CAAC;IAED;;;;OAIG;IACH,aAAa,CACX,SAAiB,EACjB,SAA4D;QAE5D,MAAM,WAAW,GAAG,IAAI,iBAAiB,CAAC,SAAS,CAAC,CAAC;QACrD,kCAAkC;QAClC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC,CAAC;QACvC,OAAO,IAAI,CAAC;IACd,CAAC;IACD;;OAEG;IACH,SAAS,CAAC,IAAY;QACpB,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,GAAG,EAAE,CAAC,aAAa,IAAI,IAAI,EAAE,CAAC,CAAC;QACvD,OAAO,IAAI,CAAC;IACd,CAAC;IAED;;OAEG;IACH,UAAU,CAAC,OAAe;QACxB,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,GAAG,EAAE,CAAC,KAAK,OAAO,EAAE,EAAE,CAAC,CAAC;QAChD,OAAO,IAAI,CAAC;IACd,CAAC;IAED;;OAEG;IACH,QAAQ;QACN,OAAO,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,KAAK,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;IAC/D,CAAC;CACF"}
@@ -0,0 +1,24 @@
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
+ * Makes deep comparison between two objects.
14
+ * @param arg1 First object to compare.
15
+ * @param arg2 Second object to compare.
16
+ * @returns true, if objects are the same, false otherwise.
17
+ */
18
+ export declare function deepCompare(arg1: object, arg2: object): boolean;
19
+ /**
20
+ * Checks if string could be represented as BigInt.
21
+ * @param value String value
22
+ * @returns true, if 'value' can be represented as BigInt; false otherwise.
23
+ */
24
+ export declare function isBigInt(value: string): boolean;
@@ -0,0 +1,47 @@
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
+ * Makes deep comparison between two objects.
14
+ * @param arg1 First object to compare.
15
+ * @param arg2 Second object to compare.
16
+ * @returns true, if objects are the same, false otherwise.
17
+ */
18
+ export function deepCompare(arg1, arg2) {
19
+ if (Object.prototype.toString.call(arg1) ===
20
+ Object.prototype.toString.call(arg2)) {
21
+ if (Object.prototype.toString.call(arg1) === '[object Object]' ||
22
+ Object.prototype.toString.call(arg1) === '[object Array]') {
23
+ if (Object.keys(arg1).length !== Object.keys(arg2).length) {
24
+ return false;
25
+ }
26
+ return Object.keys(arg1).every(function (key) {
27
+ return deepCompare(arg1[key], arg2[key]);
28
+ });
29
+ }
30
+ return arg1 === arg2;
31
+ }
32
+ return false;
33
+ }
34
+ /**
35
+ * Checks if string could be represented as BigInt.
36
+ * @param value String value
37
+ * @returns true, if 'value' can be represented as BigInt; false otherwise.
38
+ */
39
+ export function isBigInt(value) {
40
+ try {
41
+ return BigInt(parseInt(value, 10)) !== BigInt(value);
42
+ }
43
+ catch {
44
+ return false;
45
+ }
46
+ }
47
+ //# sourceMappingURL=common-utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"common-utils.js","sourceRoot":"","sources":["../../src/utils/common-utils.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;EAUE;AAEF;;;;;GAKG;AACH,MAAM,UAAU,WAAW,CAAC,IAAY,EAAE,IAAY;IACpD,IACE,MAAM,CAAC,SAAS,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC;QACpC,MAAM,CAAC,SAAS,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,EACpC,CAAC;QACD,IACE,MAAM,CAAC,SAAS,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,iBAAiB;YAC1D,MAAM,CAAC,SAAS,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,gBAAgB,EACzD,CAAC;YACD,IAAI,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,MAAM,KAAK,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,CAAC;gBAC1D,OAAO,KAAK,CAAC;YACf,CAAC;YACD,OAAO,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,KAAK,CAAC,UAAU,GAAG;gBAC1C,OAAO,WAAW,CAChB,IAAI,CAAC,GAAwB,CAAC,EAC9B,IAAI,CAAC,GAAwB,CAAC,CAC/B,CAAC;YACJ,CAAC,CAAC,CAAC;QACL,CAAC;QACD,OAAO,IAAI,KAAK,IAAI,CAAC;IACvB,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,QAAQ,CAAC,KAAa;IACpC,IAAI,CAAC;QACH,OAAO,MAAM,CAAC,QAAQ,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,KAAK,MAAM,CAAC,KAAK,CAAC,CAAC;IACvD,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,KAAK,CAAC;IACf,CAAC;AACH,CAAC"}
@@ -0,0 +1,18 @@
1
+ import type { PredefinedCardMetadata } from '../interfaces/project-interfaces.js';
2
+ export declare const INT32_MAX = 2147483647;
3
+ /**
4
+ Cyberismo
5
+ Copyright © Cyberismo Ltd and contributors 2024
6
+
7
+ 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.
8
+
9
+ 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.
10
+
11
+ You should have received a copy of the GNU Affero General Public
12
+ License along with this program. If not, see <https://www.gnu.org/licenses/>.
13
+ */
14
+ /**
15
+ * These are names of the fields that are non-custom fields that present in metadata
16
+ */
17
+ export declare const PREDEFINED_FIELDS: ("title" | "cardType" | "workflowState" | "rank" | "lastTransitioned" | "lastUpdated")[];
18
+ export declare function isPredefinedField(value: string): value is keyof PredefinedCardMetadata;
@@ -0,0 +1,27 @@
1
+ export const INT32_MAX = 2147483647; // 2^31-1
2
+ /**
3
+ Cyberismo
4
+ Copyright © Cyberismo Ltd and contributors 2024
5
+
6
+ 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.
7
+
8
+ 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.
9
+
10
+ You should have received a copy of the GNU Affero General Public
11
+ License along with this program. If not, see <https://www.gnu.org/licenses/>.
12
+ */
13
+ /**
14
+ * These are names of the fields that are non-custom fields that present in metadata
15
+ */
16
+ export const PREDEFINED_FIELDS = [
17
+ 'rank',
18
+ 'cardType',
19
+ 'title',
20
+ 'workflowState',
21
+ 'lastUpdated',
22
+ 'lastTransitioned',
23
+ ];
24
+ export function isPredefinedField(value) {
25
+ return PREDEFINED_FIELDS.includes(value);
26
+ }
27
+ //# sourceMappingURL=constants.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/utils/constants.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,SAAS,GAAG,UAAU,CAAC,CAAC,SAAS;AAC9C;;;;;;;;;;EAUE;AAEF;;GAEG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG;IAC/B,MAAM;IACN,UAAU;IACV,OAAO;IACP,eAAe;IACf,aAAa;IACb,kBAAkB;CACwB,CAAC;AAE7C,MAAM,UAAU,iBAAiB,CAC/B,KAAa;IAEb,OAAQ,iBAA8B,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;AACzD,CAAC"}