@cyberismo/data-handler 0.0.8 → 0.0.10
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.
- package/dist/command-handler.d.ts +11 -2
- package/dist/command-handler.js +61 -18
- package/dist/command-handler.js.map +1 -1
- package/dist/command-manager.js +8 -8
- package/dist/command-manager.js.map +1 -1
- package/dist/commands/calculate.d.ts +7 -44
- package/dist/commands/calculate.js +8 -389
- package/dist/commands/calculate.js.map +1 -1
- package/dist/commands/create.d.ts +6 -3
- package/dist/commands/create.js +27 -5
- package/dist/commands/create.js.map +1 -1
- package/dist/commands/edit.d.ts +15 -3
- package/dist/commands/edit.js +52 -9
- package/dist/commands/edit.js.map +1 -1
- package/dist/commands/export.d.ts +11 -9
- package/dist/commands/export.js +80 -28
- package/dist/commands/export.js.map +1 -1
- package/dist/commands/import.d.ts +7 -0
- package/dist/commands/import.js +13 -0
- package/dist/commands/import.js.map +1 -1
- package/dist/commands/move.d.ts +11 -12
- package/dist/commands/move.js +12 -13
- package/dist/commands/move.js.map +1 -1
- package/dist/commands/remove.d.ts +1 -3
- package/dist/commands/remove.js +4 -6
- package/dist/commands/remove.js.map +1 -1
- package/dist/commands/rename.d.ts +1 -3
- package/dist/commands/rename.js +3 -6
- package/dist/commands/rename.js.map +1 -1
- package/dist/commands/show.d.ts +37 -5
- package/dist/commands/show.js +89 -8
- package/dist/commands/show.js.map +1 -1
- package/dist/commands/transition.d.ts +1 -3
- package/dist/commands/transition.js +3 -5
- package/dist/commands/transition.js.map +1 -1
- package/dist/commands/update.d.ts +5 -1
- package/dist/commands/update.js +7 -1
- package/dist/commands/update.js.map +1 -1
- package/dist/commands/validate.d.ts +7 -0
- package/dist/commands/validate.js +31 -4
- package/dist/commands/validate.js.map +1 -1
- package/dist/containers/card-container.d.ts +6 -0
- package/dist/containers/card-container.js +61 -0
- package/dist/containers/card-container.js.map +1 -1
- package/dist/containers/project/calculation-engine.d.ts +90 -0
- package/dist/containers/project/calculation-engine.js +402 -0
- package/dist/containers/project/calculation-engine.js.map +1 -0
- package/dist/containers/project/resource-collector.js +9 -13
- package/dist/containers/project/resource-collector.js.map +1 -1
- package/dist/containers/project.d.ts +18 -1
- package/dist/containers/project.js +28 -55
- package/dist/containers/project.js.map +1 -1
- package/dist/containers/template.d.ts +5 -0
- package/dist/containers/template.js +9 -0
- package/dist/containers/template.js.map +1 -1
- package/dist/index.d.ts +5 -2
- package/dist/index.js +5 -1
- package/dist/index.js.map +1 -1
- package/dist/interfaces/macros.d.ts +4 -2
- package/dist/interfaces/project-interfaces.d.ts +21 -0
- package/dist/interfaces/project-interfaces.js +4 -0
- package/dist/interfaces/project-interfaces.js.map +1 -1
- package/dist/interfaces/resource-interfaces.d.ts +4 -2
- package/dist/interfaces/resource-interfaces.js.map +1 -1
- package/dist/macros/base-macro.d.ts +2 -1
- package/dist/macros/base-macro.js +14 -2
- package/dist/macros/base-macro.js.map +1 -1
- package/dist/macros/common.d.ts +16 -9
- package/dist/macros/common.js +22 -9
- package/dist/macros/common.js.map +1 -1
- package/dist/macros/createCards/index.d.ts +2 -2
- package/dist/macros/createCards/index.js +4 -0
- package/dist/macros/createCards/index.js.map +1 -1
- package/dist/macros/graph/index.d.ts +1 -3
- package/dist/macros/graph/index.js +1 -6
- package/dist/macros/graph/index.js.map +1 -1
- package/dist/macros/image/index.d.ts +39 -0
- package/dist/macros/image/index.js +82 -0
- package/dist/macros/image/index.js.map +1 -0
- package/dist/macros/image/metadata.d.ts +18 -0
- package/dist/macros/image/metadata.js +22 -0
- package/dist/macros/image/metadata.js.map +1 -0
- package/dist/macros/include/index.d.ts +31 -0
- package/dist/macros/include/index.js +94 -0
- package/dist/macros/include/index.js.map +1 -0
- package/dist/macros/include/metadata.d.ts +15 -0
- package/dist/macros/include/metadata.js +19 -0
- package/dist/macros/include/metadata.js.map +1 -0
- package/dist/macros/index.d.ts +33 -31
- package/dist/macros/index.js +142 -71
- package/dist/macros/index.js.map +1 -1
- package/dist/macros/percentage/index.d.ts +28 -0
- package/dist/macros/percentage/index.js +33 -0
- package/dist/macros/percentage/index.js.map +1 -0
- package/dist/macros/percentage/metadata.d.ts +15 -0
- package/dist/macros/percentage/metadata.js +19 -0
- package/dist/macros/percentage/metadata.js.map +1 -0
- package/dist/macros/report/index.d.ts +2 -6
- package/dist/macros/report/index.js +3 -7
- package/dist/macros/report/index.js.map +1 -1
- package/dist/macros/scoreCard/index.d.ts +14 -15
- package/dist/macros/scoreCard/index.js +14 -18
- package/dist/macros/scoreCard/index.js.map +1 -1
- package/dist/macros/vega/index.d.ts +28 -0
- package/dist/macros/vega/index.js +27 -0
- package/dist/macros/vega/index.js.map +1 -0
- package/dist/macros/vega/metadata.d.ts +15 -0
- package/dist/macros/vega/metadata.js +7 -0
- package/dist/macros/vega/metadata.js.map +1 -0
- package/dist/macros/vegalite/index.d.ts +26 -0
- package/dist/macros/vegalite/index.js +24 -0
- package/dist/macros/vegalite/index.js.map +1 -0
- package/dist/macros/vegalite/metadata.d.ts +15 -0
- package/dist/macros/vegalite/metadata.js +7 -0
- package/dist/macros/vegalite/metadata.js.map +1 -0
- package/dist/macros/xref/index.d.ts +26 -0
- package/dist/macros/xref/index.js +53 -0
- package/dist/macros/xref/index.js.map +1 -0
- package/dist/macros/xref/metadata.d.ts +15 -0
- package/dist/macros/xref/metadata.js +19 -0
- package/dist/macros/xref/metadata.js.map +1 -0
- package/dist/module-manager.d.ts +1 -0
- package/dist/module-manager.js +14 -4
- package/dist/module-manager.js.map +1 -1
- package/dist/permissions/action-guard.d.ts +2 -2
- package/dist/permissions/action-guard.js +1 -1
- package/dist/permissions/action-guard.js.map +1 -1
- package/dist/resources/card-type-resource.d.ts +2 -0
- package/dist/resources/card-type-resource.js +63 -0
- package/dist/resources/card-type-resource.js.map +1 -1
- package/dist/resources/file-resource.d.ts +2 -0
- package/dist/resources/file-resource.js +12 -4
- package/dist/resources/file-resource.js.map +1 -1
- package/dist/resources/folder-resource.d.ts +19 -0
- package/dist/resources/folder-resource.js +51 -2
- package/dist/resources/folder-resource.js.map +1 -1
- package/dist/resources/graph-model-resource.js +1 -1
- package/dist/resources/graph-model-resource.js.map +1 -1
- package/dist/resources/graph-view-resource.js +1 -1
- package/dist/resources/graph-view-resource.js.map +1 -1
- package/dist/resources/report-resource.js +1 -1
- package/dist/resources/report-resource.js.map +1 -1
- package/dist/resources/resource-object.d.ts +8 -0
- package/dist/resources/resource-object.js +10 -1
- package/dist/resources/resource-object.js.map +1 -1
- package/dist/resources/template-resource.js +1 -1
- package/dist/resources/template-resource.js.map +1 -1
- package/dist/resources/workflow-resource.d.ts +2 -0
- package/dist/resources/workflow-resource.js +53 -9
- package/dist/resources/workflow-resource.js.map +1 -1
- package/dist/svg/index.d.ts +15 -0
- package/dist/svg/index.js +16 -0
- package/dist/svg/index.js.map +1 -0
- package/dist/svg/lib.d.ts +9 -0
- package/dist/svg/lib.js +26 -0
- package/dist/svg/lib.js.map +1 -0
- package/dist/svg/percentage.d.ts +25 -0
- package/dist/svg/percentage.js +90 -0
- package/dist/svg/percentage.js.map +1 -0
- package/dist/svg/scoreCard.d.ts +19 -0
- package/dist/svg/scoreCard.js +55 -0
- package/dist/svg/scoreCard.js.map +1 -0
- package/dist/types/queries.d.ts +8 -7
- package/dist/types/queries.js.map +1 -1
- package/dist/utils/card-utils.d.ts +6 -0
- package/dist/utils/card-utils.js +12 -0
- package/dist/utils/card-utils.js.map +1 -1
- package/dist/utils/clingo-facts.d.ts +2 -1
- package/dist/utils/clingo-facts.js +19 -2
- package/dist/utils/clingo-facts.js.map +1 -1
- package/dist/utils/clingo-parser.d.ts +1 -0
- package/dist/utils/clingo-parser.js +22 -100
- package/dist/utils/clingo-parser.js.map +1 -1
- package/dist/utils/constants.d.ts +7 -0
- package/dist/utils/constants.js +14 -0
- package/dist/utils/constants.js.map +1 -1
- package/dist/utils/csv.js.map +1 -1
- package/dist/utils/report.d.ts +17 -3
- package/dist/utils/report.js +38 -2
- package/dist/utils/report.js.map +1 -1
- package/dist/utils/resource-utils.d.ts +2 -1
- package/dist/utils/resource-utils.js +12 -3
- package/dist/utils/resource-utils.js.map +1 -1
- package/dist/utils/user-preferences.d.ts +1 -11
- package/dist/utils/user-preferences.js +30 -13
- package/dist/utils/user-preferences.js.map +1 -1
- package/dist/utils/validate.d.ts +2 -3
- package/dist/utils/validate.js +2 -2
- package/dist/utils/validate.js.map +1 -1
- package/package.json +8 -6
- package/src/command-handler.ts +96 -17
- package/src/command-manager.ts +8 -8
- package/src/commands/calculate.ts +11 -525
- package/src/commands/create.ts +35 -6
- package/src/commands/edit.ts +94 -11
- package/src/commands/export.ts +104 -31
- package/src/commands/import.ts +16 -0
- package/src/commands/move.ts +12 -15
- package/src/commands/remove.ts +4 -8
- package/src/commands/rename.ts +3 -12
- package/src/commands/show.ts +126 -9
- package/src/commands/transition.ts +3 -7
- package/src/commands/update.ts +6 -0
- package/src/commands/validate.ts +41 -13
- package/src/containers/card-container.ts +74 -0
- package/src/containers/project/calculation-engine.ts +535 -0
- package/src/containers/project/resource-collector.ts +13 -15
- package/src/containers/project.ts +30 -66
- package/src/containers/template.ts +16 -0
- package/src/index.ts +13 -2
- package/src/interfaces/macros.ts +4 -1
- package/src/interfaces/project-interfaces.ts +27 -0
- package/src/interfaces/resource-interfaces.ts +5 -2
- package/src/macros/base-macro.ts +19 -4
- package/src/macros/common.ts +22 -9
- package/src/macros/createCards/index.ts +6 -2
- package/src/macros/graph/index.ts +6 -10
- package/src/macros/image/index.ts +128 -0
- package/src/macros/image/metadata.ts +25 -0
- package/src/macros/include/index.ts +143 -0
- package/src/macros/include/metadata.ts +22 -0
- package/src/macros/index.ts +150 -98
- package/src/macros/percentage/index.ts +50 -0
- package/src/macros/percentage/metadata.ts +22 -0
- package/src/macros/report/index.ts +4 -12
- package/src/macros/scoreCard/index.ts +21 -25
- package/src/macros/vega/index.ts +55 -0
- package/src/macros/vega/metadata.ts +21 -0
- package/src/macros/vegalite/index.ts +46 -0
- package/src/macros/vegalite/metadata.ts +21 -0
- package/src/macros/xref/index.ts +73 -0
- package/src/macros/xref/metadata.ts +22 -0
- package/src/module-manager.ts +15 -5
- package/src/permissions/action-guard.ts +3 -3
- package/src/resources/card-type-resource.ts +100 -0
- package/src/resources/file-resource.ts +16 -4
- package/src/resources/folder-resource.ts +59 -2
- package/src/resources/graph-model-resource.ts +1 -1
- package/src/resources/graph-view-resource.ts +1 -1
- package/src/resources/report-resource.ts +1 -1
- package/src/resources/resource-object.ts +19 -1
- package/src/resources/template-resource.ts +1 -1
- package/src/resources/workflow-resource.ts +68 -13
- package/src/svg/index.ts +15 -0
- package/src/svg/lib.ts +31 -0
- package/src/svg/percentage.ts +97 -0
- package/src/svg/scoreCard.ts +88 -0
- package/src/types/queries.ts +8 -7
- package/src/types/string-pixel-width.d.ts +23 -0
- package/src/utils/card-utils.ts +13 -0
- package/src/utils/clingo-facts.ts +65 -3
- package/src/utils/clingo-parser.ts +31 -144
- package/src/utils/constants.ts +16 -0
- package/src/utils/csv.ts +1 -1
- package/src/utils/report.ts +45 -4
- package/src/utils/resource-utils.ts +12 -2
- package/src/utils/user-preferences.ts +32 -14
- package/src/utils/validate.ts +3 -3
package/dist/macros/index.js
CHANGED
|
@@ -1,46 +1,128 @@
|
|
|
1
1
|
/**
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
2
|
+
Cyberismo
|
|
3
|
+
Copyright © Cyberismo Ltd and contributors 2024
|
|
4
|
+
This program is free software: you can redistribute it and/or modify it under
|
|
5
|
+
the terms of the GNU Affero General Public License version 3 as published by
|
|
6
|
+
the Free Software Foundation.
|
|
7
|
+
This program is distributed in the hope that it will be useful, but WITHOUT
|
|
8
|
+
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
|
9
|
+
FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
|
|
10
|
+
details. 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/>.
|
|
11
12
|
*/
|
|
12
13
|
import Handlebars from 'handlebars';
|
|
13
14
|
import createCards from './createCards/index.js';
|
|
14
15
|
import graph from './graph/index.js';
|
|
16
|
+
import image from './image/index.js';
|
|
17
|
+
import include from './include/index.js';
|
|
15
18
|
import report from './report/index.js';
|
|
16
19
|
import scoreCard from './scoreCard/index.js';
|
|
20
|
+
import xref from './xref/index.js';
|
|
21
|
+
import percentage from './percentage/index.js';
|
|
22
|
+
import vega from './vega/index.js';
|
|
23
|
+
import vegaLite from './vegalite/index.js';
|
|
17
24
|
import { validateJson } from '../utils/validate.js';
|
|
18
25
|
import { DHValidationError, MacroError } from '../exceptions/index.js';
|
|
19
26
|
import TaskQueue from './task-queue.js';
|
|
20
27
|
import { ClingoError } from '@cyberismo/node-clingo';
|
|
21
28
|
const CURLY_LEFT = '{';
|
|
22
29
|
const CURLY_RIGHT = '}';
|
|
30
|
+
const RAW_BLOCK_OPEN = '{{#raw}}';
|
|
31
|
+
const RAW_BLOCK_CLOSE = '{{/raw}}';
|
|
32
|
+
/**
|
|
33
|
+
* Pre-processes the content to handle {{#raw}} blocks by escaping all handlebars syntax inside them
|
|
34
|
+
* @param content The template content to process
|
|
35
|
+
* @returns The processed content with raw blocks escaped
|
|
36
|
+
* @throws Error if nested raw blocks are found or if a raw block is not properly closed
|
|
37
|
+
*/
|
|
38
|
+
function preprocessRawBlocks(content) {
|
|
39
|
+
const result = [];
|
|
40
|
+
let i = 0;
|
|
41
|
+
// Helper function to check if a target string matches at a given position without creating substrings
|
|
42
|
+
const matchesAt = (pos, target) => {
|
|
43
|
+
if (pos + target.length > content.length)
|
|
44
|
+
return false;
|
|
45
|
+
for (let k = 0; k < target.length; k++) {
|
|
46
|
+
if (content[pos + k] !== target[k])
|
|
47
|
+
return false;
|
|
48
|
+
}
|
|
49
|
+
return true;
|
|
50
|
+
};
|
|
51
|
+
// Helper function to get line number at position
|
|
52
|
+
const getLineNumber = (pos) => {
|
|
53
|
+
let lineNum = 1;
|
|
54
|
+
for (let k = 0; k < pos; k++) {
|
|
55
|
+
if (content[k] === '\n') {
|
|
56
|
+
lineNum++;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
return lineNum;
|
|
60
|
+
};
|
|
61
|
+
while (i < content.length) {
|
|
62
|
+
// Check for {{#raw}}
|
|
63
|
+
if (matchesAt(i, RAW_BLOCK_OPEN)) {
|
|
64
|
+
const openingLine = getLineNumber(i);
|
|
65
|
+
// Find the matching {{/raw}} - no nesting allowed
|
|
66
|
+
let j = i + RAW_BLOCK_OPEN.length;
|
|
67
|
+
while (j < content.length) {
|
|
68
|
+
if (matchesAt(j, RAW_BLOCK_OPEN)) {
|
|
69
|
+
// Found nested raw block - not supported
|
|
70
|
+
const nestedLine = getLineNumber(j);
|
|
71
|
+
throw new Error(`Nested ${RAW_BLOCK_OPEN} blocks are not supported. Found nested raw block inside another raw block on line ${nestedLine} (original raw block started on line ${openingLine}).`);
|
|
72
|
+
}
|
|
73
|
+
else if (matchesAt(j, RAW_BLOCK_CLOSE)) {
|
|
74
|
+
// Found matching closing tag
|
|
75
|
+
const rawContent = content.slice(i + RAW_BLOCK_OPEN.length, j);
|
|
76
|
+
const escapedContent = rawContent
|
|
77
|
+
.replaceAll('{', CURLY_LEFT)
|
|
78
|
+
.replaceAll('}', CURLY_RIGHT);
|
|
79
|
+
result.push(escapedContent);
|
|
80
|
+
i = j + RAW_BLOCK_CLOSE.length;
|
|
81
|
+
break;
|
|
82
|
+
}
|
|
83
|
+
else {
|
|
84
|
+
j++;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
// If we reached the end without finding a closing tag
|
|
88
|
+
if (j >= content.length) {
|
|
89
|
+
throw new Error(`Unclosed ${RAW_BLOCK_OPEN} block found on line ${openingLine}. Every ${RAW_BLOCK_OPEN} must have a matching ${RAW_BLOCK_CLOSE}.`);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
else {
|
|
93
|
+
// Not a raw block, keep as-is
|
|
94
|
+
result.push(content[i]);
|
|
95
|
+
i++;
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
return result.join('');
|
|
99
|
+
}
|
|
23
100
|
export const macros = {
|
|
24
101
|
createCards,
|
|
25
102
|
graph,
|
|
103
|
+
image,
|
|
104
|
+
include,
|
|
26
105
|
report,
|
|
27
106
|
scoreCard,
|
|
107
|
+
xref,
|
|
108
|
+
percentage,
|
|
109
|
+
vega,
|
|
110
|
+
vegaLite,
|
|
28
111
|
};
|
|
29
112
|
/**
|
|
30
113
|
* Validates the content inside a macro
|
|
31
114
|
* @param macro - The macro to validate the content of
|
|
32
115
|
* @param data - The data to validate
|
|
33
|
-
* @param validator - The validator to use
|
|
34
116
|
* @returns The validated data
|
|
35
117
|
*/
|
|
36
|
-
export function validateMacroContent(macro, data,
|
|
118
|
+
export function validateMacroContent(macro, data, schema) {
|
|
37
119
|
if (!macro.schema) {
|
|
38
120
|
throw new Error(`Macro ${macro.name} does not have a schema`);
|
|
39
121
|
}
|
|
40
122
|
try {
|
|
41
123
|
return validateJson(data, {
|
|
42
124
|
schemaId: macro.schema,
|
|
43
|
-
|
|
125
|
+
schema,
|
|
44
126
|
});
|
|
45
127
|
}
|
|
46
128
|
catch (error) {
|
|
@@ -55,28 +137,16 @@ export function validateMacroContent(macro, data, validator) {
|
|
|
55
137
|
* Registers the macros with Handlebars
|
|
56
138
|
* @param {Mode} mode - The mode to register the macros in
|
|
57
139
|
*/
|
|
58
|
-
export function registerMacros(instance, context, tasks
|
|
140
|
+
export function registerMacros(instance, context, tasks) {
|
|
59
141
|
const macroInstances = [];
|
|
60
142
|
for (const macro of Object.keys(macros)) {
|
|
61
143
|
const MacroClass = macros[macro];
|
|
62
|
-
const macroInstance = new MacroClass(tasks
|
|
144
|
+
const macroInstance = new MacroClass(tasks);
|
|
63
145
|
instance.registerHelper(macro, function (options) {
|
|
64
|
-
if (this != null &&
|
|
65
|
-
typeof this === 'object' &&
|
|
66
|
-
'__isRaw' in this &&
|
|
67
|
-
this.__isRaw) {
|
|
68
|
-
// we use escaped chars so that they will not be re-run
|
|
69
|
-
return `${CURLY_LEFT}${CURLY_LEFT}#${macro}${CURLY_RIGHT}${CURLY_RIGHT}${options.fn(this)}${CURLY_LEFT}${CURLY_LEFT}/${macro}${CURLY_RIGHT}${CURLY_RIGHT}`;
|
|
70
|
-
}
|
|
71
146
|
return macroInstance.invokeMacro(context, options);
|
|
72
147
|
});
|
|
73
148
|
macroInstances.push(macroInstance);
|
|
74
149
|
}
|
|
75
|
-
instance.registerHelper('raw', function (options) {
|
|
76
|
-
return options.fn({
|
|
77
|
-
__isRaw: true,
|
|
78
|
-
});
|
|
79
|
-
});
|
|
80
150
|
return macroInstances;
|
|
81
151
|
}
|
|
82
152
|
/**
|
|
@@ -104,20 +174,22 @@ export function registerEmptyMacros(instance) {
|
|
|
104
174
|
/**
|
|
105
175
|
* Handle the macros in the content
|
|
106
176
|
* @param content - The content to handle the macros in
|
|
107
|
-
* @param
|
|
177
|
+
* @param context - The context for macro generation
|
|
178
|
+
* @param calculate - The calculate function
|
|
179
|
+
* @param preserveRawBlocks - If true, don't unescape raw blocks at the end (for nested evaluations)
|
|
108
180
|
*/
|
|
109
|
-
export async function evaluateMacros(content, context,
|
|
181
|
+
export async function evaluateMacros(content, context, preserveRawBlocks = false) {
|
|
110
182
|
const handlebars = Handlebars.create();
|
|
111
183
|
const tasks = new TaskQueue();
|
|
112
|
-
registerMacros(handlebars, context, tasks
|
|
184
|
+
registerMacros(handlebars, context, tasks);
|
|
113
185
|
let result = content;
|
|
114
|
-
while (maxTries
|
|
186
|
+
while ((context.maxTries ?? 10) > 0) {
|
|
115
187
|
tasks.reset();
|
|
116
|
-
const compiled = handlebars.compile(result, {
|
|
117
|
-
strict: true,
|
|
118
|
-
});
|
|
119
188
|
try {
|
|
120
|
-
|
|
189
|
+
const compiled = handlebars.compile(preprocessRawBlocks(result), {
|
|
190
|
+
strict: true,
|
|
191
|
+
});
|
|
192
|
+
result = compiled({ cardKey: context.cardKey });
|
|
121
193
|
await tasks.waitAll();
|
|
122
194
|
result = applyMacroResults(result, tasks, context);
|
|
123
195
|
if (macroCount(result) === 0) {
|
|
@@ -132,7 +204,10 @@ export async function evaluateMacros(content, context, calculate, maxTries = 10)
|
|
|
132
204
|
if (macroCount(result) !== 0) {
|
|
133
205
|
return handleMacroError(new Error(`Too many recursive macro evaluations.`), '', context);
|
|
134
206
|
}
|
|
135
|
-
|
|
207
|
+
// Only unescape raw blocks if we're not preserving them for nested evaluations
|
|
208
|
+
return preserveRawBlocks
|
|
209
|
+
? result
|
|
210
|
+
: result.replaceAll(CURLY_LEFT, '{').replaceAll(CURLY_RIGHT, '}');
|
|
136
211
|
}
|
|
137
212
|
/**
|
|
138
213
|
* This function assumes that tasks, which were started by macros, are complete.
|
|
@@ -195,38 +270,19 @@ export function handleMacroError(error, macro, context) {
|
|
|
195
270
|
// This is used to generate unique keys for macros
|
|
196
271
|
// There might be a better way to do this
|
|
197
272
|
let macroCounter = 0;
|
|
273
|
+
function objectToBase64(obj) {
|
|
274
|
+
return Buffer.from(JSON.stringify(obj), 'utf-8').toString('base64');
|
|
275
|
+
}
|
|
198
276
|
/**
|
|
199
|
-
* Creates
|
|
200
|
-
*
|
|
201
|
-
* @param
|
|
277
|
+
* Creates a placeholder for a macro
|
|
278
|
+
* Options are encoded as base64
|
|
279
|
+
* @param macro - The macro to create a placeholder for
|
|
280
|
+
* @param options - The options for the macro
|
|
281
|
+
* @returns The placeholder for the macro
|
|
202
282
|
*/
|
|
203
283
|
export function createHtmlPlaceholder(macro, options) {
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
// Helper function to flatten nested objects
|
|
207
|
-
const flatten = (obj, prefix = '') => {
|
|
208
|
-
Object.entries(obj).forEach(([key, value]) => {
|
|
209
|
-
const newKey = prefix ? `${prefix}.${key}` : key;
|
|
210
|
-
if (value !== null &&
|
|
211
|
-
typeof value === 'object' &&
|
|
212
|
-
!Array.isArray(value)) {
|
|
213
|
-
// Recursively flatten nested objects
|
|
214
|
-
flatten(value, newKey);
|
|
215
|
-
}
|
|
216
|
-
else {
|
|
217
|
-
// Add leaf values to flattened options
|
|
218
|
-
flattenedOptions[newKey] = value;
|
|
219
|
-
}
|
|
220
|
-
});
|
|
221
|
-
};
|
|
222
|
-
flatten(options);
|
|
223
|
-
// Convert flattened options to attribute strings
|
|
224
|
-
const attributeStrings = Object.entries(flattenedOptions)
|
|
225
|
-
.filter(([, value]) => value !== undefined)
|
|
226
|
-
.map(([key, value]) => `${key}="${value}"`);
|
|
227
|
-
const optionString = attributeStrings.join(' ');
|
|
228
|
-
// start with a line change to ensure that inline passthrough +++ is on its own line
|
|
229
|
-
return `\n+++\n<${macro.tagName}${optionString ? ` ${optionString}` : ''} key="macro-${macroCounter++}"></${macro.tagName}>\n+++\n`;
|
|
284
|
+
const optionsBase64 = objectToBase64(options);
|
|
285
|
+
return `\n\n++++\n<${macro.tagName} options="${optionsBase64}" key="macro-${macroCounter++}"></${macro.tagName}>\n++++\n\n`;
|
|
230
286
|
}
|
|
231
287
|
/**
|
|
232
288
|
* Creates an adoc admonition
|
|
@@ -251,17 +307,32 @@ export function createCodeBlock(content) {
|
|
|
251
307
|
* @param image base64 encoded image
|
|
252
308
|
* @returns valid asciidoc with the image
|
|
253
309
|
*/
|
|
254
|
-
export function createImage(image) {
|
|
310
|
+
export function createImage(image, controls = true) {
|
|
255
311
|
if (process.env.EXPORT_FORMAT) {
|
|
256
312
|
return `image::data:image/svg+xml;base64,${image}[]\n`;
|
|
257
313
|
}
|
|
258
314
|
else {
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
${
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
`;
|
|
315
|
+
const svg = Buffer.from(image, 'base64').toString('utf-8');
|
|
316
|
+
if (controls) {
|
|
317
|
+
return `++++\n<div class="cyberismo-svg-wrapper" data-type="cyberismo-svg-wrapper">\n${svg}\n</div>\n++++\n`;
|
|
318
|
+
}
|
|
319
|
+
else {
|
|
320
|
+
return `++++\n${svg}\n++++\n`;
|
|
321
|
+
}
|
|
322
|
+
}
|
|
323
|
+
}
|
|
324
|
+
/**
|
|
325
|
+
* Creates a Handlebars macro block string with the given macro name and options.
|
|
326
|
+
*
|
|
327
|
+
* @param macro - The name of the macro to create (e.g., 'scoreCard', 'include').
|
|
328
|
+
* @param options - The options object to be stringified and inserted as macro content.
|
|
329
|
+
* @returns The Handlebars macro block as a string, e.g. {{#macro}}...{{/macro}}
|
|
330
|
+
*/
|
|
331
|
+
export function createMacro(macro, options) {
|
|
332
|
+
let optionsString = JSON.stringify(options, null, 0);
|
|
333
|
+
if (optionsString.length > 1) {
|
|
334
|
+
optionsString = optionsString.slice(1, -1);
|
|
265
335
|
}
|
|
336
|
+
return `{{#${macro}}}${optionsString}{{/${macro}}}`;
|
|
266
337
|
}
|
|
267
338
|
//# sourceMappingURL=index.js.map
|
package/dist/macros/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/macros/index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/macros/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;EAWE;AAEF,OAAO,UAAU,MAAM,YAAY,CAAC;AAEpC,OAAO,WAAW,MAAM,wBAAwB,CAAC;AACjD,OAAO,KAAK,MAAM,kBAAkB,CAAC;AACrC,OAAO,KAAK,MAAM,kBAAkB,CAAC;AACrC,OAAO,OAAO,MAAM,oBAAoB,CAAC;AACzC,OAAO,MAAM,MAAM,mBAAmB,CAAC;AACvC,OAAO,SAAS,MAAM,sBAAsB,CAAC;AAC7C,OAAO,IAAI,MAAM,iBAAiB,CAAC;AACnC,OAAO,UAAU,MAAM,uBAAuB,CAAC;AAC/C,OAAO,IAAI,MAAM,iBAAiB,CAAC;AACnC,OAAO,QAA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C,CAAC,CAAC;IACrD,IAAI,aAAa,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QAC7B,aAAa,GAAG,aAAa,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;IAC7C,CAAC;IACD,OAAO,MAAM,KAAK,KAAK,aAAa,MAAM,KAAK,IAAI,CAAC;AACtD,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
Cyberismo
|
|
3
|
+
Copyright © Cyberismo Ltd and contributors 2025
|
|
4
|
+
This program is free software: you can redistribute it and/or modify it under
|
|
5
|
+
the terms of the GNU Affero General Public License version 3 as published by
|
|
6
|
+
the Free Software Foundation. This program is distributed in the hope that it
|
|
7
|
+
will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty
|
|
8
|
+
of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
9
|
+
See the GNU Affero General Public License for more details.
|
|
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
|
+
import type { MacroGenerationContext } from '../../interfaces/macros.js';
|
|
14
|
+
import BaseMacro from '../base-macro.js';
|
|
15
|
+
import type TaskQueue from '../task-queue.js';
|
|
16
|
+
export interface PercentageOptions {
|
|
17
|
+
title: string;
|
|
18
|
+
value: number;
|
|
19
|
+
legend: string;
|
|
20
|
+
colour?: 'blue' | 'green' | 'yellow' | 'red' | 'orange' | 'purple';
|
|
21
|
+
}
|
|
22
|
+
declare class PercentageMacro extends BaseMacro {
|
|
23
|
+
constructor(tasksQueue: TaskQueue);
|
|
24
|
+
handleValidate: (data: string) => void;
|
|
25
|
+
handleStatic: (_: MacroGenerationContext, input: unknown) => Promise<string>;
|
|
26
|
+
private validate;
|
|
27
|
+
}
|
|
28
|
+
export default PercentageMacro;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
Cyberismo
|
|
3
|
+
Copyright © Cyberismo Ltd and contributors 2025
|
|
4
|
+
This program is free software: you can redistribute it and/or modify it under
|
|
5
|
+
the terms of the GNU Affero General Public License version 3 as published by
|
|
6
|
+
the Free Software Foundation. This program is distributed in the hope that it
|
|
7
|
+
will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty
|
|
8
|
+
of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
9
|
+
See the GNU Affero General Public License for more details.
|
|
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
|
+
import { createImage, validateMacroContent } from '../index.js';
|
|
14
|
+
import macroMetadata from './metadata.js';
|
|
15
|
+
import BaseMacro from '../base-macro.js';
|
|
16
|
+
import { percentage } from '../../svg/index.js';
|
|
17
|
+
class PercentageMacro extends BaseMacro {
|
|
18
|
+
constructor(tasksQueue) {
|
|
19
|
+
super(macroMetadata, tasksQueue);
|
|
20
|
+
}
|
|
21
|
+
handleValidate = (data) => {
|
|
22
|
+
this.validate(data);
|
|
23
|
+
};
|
|
24
|
+
handleStatic = async (_, input) => {
|
|
25
|
+
const options = this.validate(input);
|
|
26
|
+
return createImage(Buffer.from(percentage(options)).toString('base64'), false);
|
|
27
|
+
};
|
|
28
|
+
validate(input) {
|
|
29
|
+
return validateMacroContent(this.metadata, input);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
export default PercentageMacro;
|
|
33
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/macros/percentage/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;EAWE;AAEF,OAAO,EAAE,WAAW,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAGhE,OAAO,aAAa,MAAM,eAAe,CAAC;AAC1C,OAAO,SAAS,MAAM,kBAAkB,CAAC;AAEzC,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAShD,MAAM,eAAgB,SAAQ,SAAS;IACrC,YAAY,UAAqB;QAC/B,KAAK,CAAC,aAAa,EAAE,UAAU,CAAC,CAAC;IACnC,CAAC;IACD,cAAc,GAAG,CAAC,IAAY,EAAE,EAAE;QAChC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;IACtB,CAAC,CAAC;IAEF,YAAY,GAAG,KAAK,EAAE,CAAyB,EAAE,KAAc,EAAE,EAAE;QACjE,MAAM,OAAO,GAAG,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;QACrC,OAAO,WAAW,CAChB,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,EACnD,KAAK,CACN,CAAC;IACJ,CAAC,CAAC;IAEM,QAAQ,CAAC,KAAc;QAC7B,OAAO,oBAAoB,CAAoB,IAAI,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC;IACvE,CAAC;CACF;AAED,eAAe,eAAe,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
Cyberismo
|
|
3
|
+
Copyright © Cyberismo Ltd and contributors 2025
|
|
4
|
+
This program is free software: you can redistribute it and/or modify it under
|
|
5
|
+
the terms of the GNU Affero General Public License version 3 as published by
|
|
6
|
+
the Free Software Foundation. This program is distributed in the hope that it
|
|
7
|
+
will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty
|
|
8
|
+
of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
9
|
+
See the GNU Affero General Public License for more details.
|
|
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
|
+
import type { MacroMetadata } from '../../interfaces/macros.js';
|
|
14
|
+
declare const macroMetadata: MacroMetadata;
|
|
15
|
+
export default macroMetadata;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
Cyberismo
|
|
3
|
+
Copyright © Cyberismo Ltd and contributors 2025
|
|
4
|
+
This program is free software: you can redistribute it and/or modify it under
|
|
5
|
+
the terms of the GNU Affero General Public License version 3 as published by
|
|
6
|
+
the Free Software Foundation. This program is distributed in the hope that it
|
|
7
|
+
will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty
|
|
8
|
+
of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
9
|
+
See the GNU Affero General Public License for more details.
|
|
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
|
+
const macroMetadata = {
|
|
14
|
+
name: 'percentage',
|
|
15
|
+
tagName: 'percentage',
|
|
16
|
+
schema: 'percentageMacroSchema',
|
|
17
|
+
};
|
|
18
|
+
export default macroMetadata;
|
|
19
|
+
//# sourceMappingURL=metadata.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"metadata.js","sourceRoot":"","sources":["../../../src/macros/percentage/metadata.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;EAWE;AAIF,MAAM,aAAa,GAAkB;IACnC,IAAI,EAAE,YAAY;IAClB,OAAO,EAAE,YAAY;IACrB,MAAM,EAAE,uBAAuB;CAChC,CAAC;AAEF,eAAe,aAAa,CAAC"}
|
|
@@ -10,20 +10,16 @@
|
|
|
10
10
|
You should have received a copy of the GNU Affero General Public
|
|
11
11
|
License along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
12
12
|
*/
|
|
13
|
-
import type { MacroOptions } from '../index.js';
|
|
14
13
|
import type { MacroGenerationContext } from '../../interfaces/macros.js';
|
|
15
|
-
import type { Calculate } from '../../commands/index.js';
|
|
16
14
|
import BaseMacro from '../base-macro.js';
|
|
17
15
|
import type TaskQueue from '../task-queue.js';
|
|
18
|
-
export interface ReportOptions
|
|
16
|
+
export interface ReportOptions {
|
|
19
17
|
name: string;
|
|
20
18
|
}
|
|
21
19
|
declare class ReportMacro extends BaseMacro {
|
|
22
|
-
|
|
23
|
-
constructor(tasks: TaskQueue, calculate: Calculate);
|
|
20
|
+
constructor(tasks: TaskQueue);
|
|
24
21
|
handleValidate: (input: unknown) => void;
|
|
25
22
|
handleStatic: (context: MacroGenerationContext, data: unknown) => Promise<string>;
|
|
26
|
-
handleInject: (context: MacroGenerationContext, data: unknown) => Promise<string>;
|
|
27
23
|
private validate;
|
|
28
24
|
}
|
|
29
25
|
export default ReportMacro;
|
|
@@ -19,18 +19,13 @@ import { resourceName } from '../../utils/resource-utils.js';
|
|
|
19
19
|
import { generateReportContent } from '../../utils/report.js';
|
|
20
20
|
import { ClingoError } from '@cyberismo/node-clingo';
|
|
21
21
|
class ReportMacro extends BaseMacro {
|
|
22
|
-
|
|
23
|
-
constructor(tasks, calculate) {
|
|
22
|
+
constructor(tasks) {
|
|
24
23
|
super(macroMetadata, tasks);
|
|
25
|
-
this.calculate = calculate;
|
|
26
24
|
}
|
|
27
25
|
handleValidate = (input) => {
|
|
28
26
|
this.validate(input);
|
|
29
27
|
};
|
|
30
28
|
handleStatic = async (context, data) => {
|
|
31
|
-
return this.handleInject(context, data);
|
|
32
|
-
};
|
|
33
|
-
handleInject = async (context, data) => {
|
|
34
29
|
const options = this.validate(data);
|
|
35
30
|
const resource = new ReportResource(context.project, resourceName(options.name));
|
|
36
31
|
const report = await resource.show();
|
|
@@ -43,13 +38,14 @@ class ReportMacro extends BaseMacro {
|
|
|
43
38
|
}
|
|
44
39
|
try {
|
|
45
40
|
return await generateReportContent({
|
|
46
|
-
calculate:
|
|
41
|
+
calculate: context.project.calculationEngine,
|
|
47
42
|
contentTemplate: report.contentTemplate,
|
|
48
43
|
queryTemplate: report.queryTemplate,
|
|
49
44
|
options: {
|
|
50
45
|
cardKey: context.cardKey,
|
|
51
46
|
...options,
|
|
52
47
|
},
|
|
48
|
+
context: context.context,
|
|
53
49
|
});
|
|
54
50
|
}
|
|
55
51
|
catch (error) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/macros/report/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;EAWE;AAEF,OAAO,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/macros/report/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;EAWE;AAEF,OAAO,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAGnD,OAAO,aAAa,MAAM,eAAe,CAAC;AAC1C,OAAO,SAAS,MAAM,kBAAkB,CAAC;AACzC,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAEvD,OAAO,EAAE,cAAc,EAAE,MAAM,oCAAoC,CAAC;AACpE,OAAO,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAC7D,OAAO,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AAC9D,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAMrD,MAAM,WAAY,SAAQ,SAAS;IACjC,YAAY,KAAgB;QAC1B,KAAK,CAAC,aAAa,EAAE,KAAK,CAAC,CAAC;IAC9B,CAAC;IACD,cAAc,GAAG,CAAC,KAAc,EAAE,EAAE;QAClC,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;IACvB,CAAC,CAAC;IAEF,YAAY,GAAG,KAAK,EAAE,OAA+B,EAAE,IAAa,EAAE,EAAE;QACtE,MAAM,OAAO,GAAG,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;QACpC,MAAM,QAAQ,GAAG,IAAI,cAAc,CACjC,OAAO,CAAC,OAAO,EACf,YAAY,CAAC,OAAO,CAAC,IAAI,CAAC,CAC3B,CAAC;QACF,MAAM,MAAM,GAAG,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAC;QAErC,IAAI,CAAC,MAAM;YAAE,MAAM,IAAI,KAAK,CAAC,UAAU,OAAO,CAAC,IAAI,iBAAiB,CAAC,CAAC;QAEtE,IAAI,MAAM,CAAC,MAAM,EAAE,CAAC;YAClB,YAAY,CAAC,OAAO,EAAE;gBACpB,MAAM,EAAE,MAAM,CAAC,MAAM;aACtB,CAAC,CAAC;QACL,CAAC;QACD,IAAI,CAAC;YACH,OAAO,MAAM,qBAAqB,CAAC;gBACjC,SAAS,EAAE,OAAO,CAAC,OAAO,CAAC,iBAAiB;gBAC5C,eAAe,EAAE,MAAM,CAAC,eAAe;gBACvC,aAAa,EAAE,MAAM,CAAC,aAAa;gBACnC,OAAO,EAAE;oBACP,OAAO,EAAE,OAAO,CAAC,OAAO;oBACxB,GAAG,OAAO;iBACX;gBACD,OAAO,EAAE,OAAO,CAAC,OAAO;aACzB,CAAC,CAAC;QACL,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,IAAI,KAAK,YAAY,WAAW,EAAE,CAAC;gBACjC,MAAM,IAAI,KAAK,CACb,0CAA0C,OAAO,CAAC,IAAI,KAAK,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAC7F,CAAC;YACJ,CAAC;YACD,MAAM,KAAK,CAAC;QACd,CAAC;IACH,CAAC,CAAC;IAEM,QAAQ,CAAC,IAAa;QAC5B,OAAO,oBAAoB,CAAgB,IAAI,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;IAClE,CAAC;CACF;AAED,eAAe,WAAW,CAAC"}
|
|
@@ -1,30 +1,29 @@
|
|
|
1
1
|
/**
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
Cyberismo
|
|
3
|
+
Copyright © Cyberismo Ltd and contributors 2024
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
5
|
+
This program is free software: you can redistribute it and/or modify it under
|
|
6
|
+
the terms of the GNU Affero General Public License version 3 as published by
|
|
7
|
+
the Free Software Foundation. This program is distributed in the hope that it
|
|
8
|
+
will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty
|
|
9
|
+
of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
10
|
+
See the GNU Affero General Public License for more details.
|
|
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/>.
|
|
11
13
|
*/
|
|
12
|
-
import type { MacroOptions } from '../index.js';
|
|
13
14
|
import type { MacroGenerationContext } from '../../interfaces/macros.js';
|
|
14
15
|
import BaseMacro from '../base-macro.js';
|
|
15
16
|
import type TaskQueue from '../task-queue.js';
|
|
16
|
-
export interface ScoreCardOptions
|
|
17
|
-
title?: string;
|
|
17
|
+
export interface ScoreCardOptions {
|
|
18
18
|
value: number;
|
|
19
|
-
unit?: string;
|
|
20
19
|
legend?: string;
|
|
20
|
+
title?: string;
|
|
21
|
+
unit?: string;
|
|
21
22
|
}
|
|
22
23
|
declare class ScoreCardMacro extends BaseMacro {
|
|
23
24
|
constructor(tasksQueue: TaskQueue);
|
|
24
25
|
handleValidate: (data: string) => void;
|
|
25
|
-
handleStatic: (
|
|
26
|
-
handleInject: (_: MacroGenerationContext, input: unknown) => Promise<string>;
|
|
26
|
+
handleStatic: (_: MacroGenerationContext, input: unknown) => Promise<string>;
|
|
27
27
|
private validate;
|
|
28
|
-
private createAsciidocElement;
|
|
29
28
|
}
|
|
30
29
|
export default ScoreCardMacro;
|
|
@@ -1,17 +1,20 @@
|
|
|
1
1
|
/**
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
Cyberismo
|
|
3
|
+
Copyright © Cyberismo Ltd and contributors 2024
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
5
|
+
This program is free software: you can redistribute it and/or modify it under
|
|
6
|
+
the terms of the GNU Affero General Public License version 3 as published by
|
|
7
|
+
the Free Software Foundation. This program is distributed in the hope that it
|
|
8
|
+
will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty
|
|
9
|
+
of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
10
|
+
See the GNU Affero General Public License for more details.
|
|
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/>.
|
|
11
13
|
*/
|
|
12
|
-
import {
|
|
14
|
+
import { createImage, validateMacroContent } from '../index.js';
|
|
13
15
|
import macroMetadata from './metadata.js';
|
|
14
16
|
import BaseMacro from '../base-macro.js';
|
|
17
|
+
import { scoreCard } from '../../svg/index.js';
|
|
15
18
|
class ScoreCardMacro extends BaseMacro {
|
|
16
19
|
constructor(tasksQueue) {
|
|
17
20
|
super(macroMetadata, tasksQueue);
|
|
@@ -19,20 +22,13 @@ class ScoreCardMacro extends BaseMacro {
|
|
|
19
22
|
handleValidate = (data) => {
|
|
20
23
|
this.validate(data);
|
|
21
24
|
};
|
|
22
|
-
handleStatic = async (
|
|
25
|
+
handleStatic = async (_, input) => {
|
|
23
26
|
const options = this.validate(input);
|
|
24
|
-
return
|
|
25
|
-
};
|
|
26
|
-
handleInject = async (_, input) => {
|
|
27
|
-
const options = this.validate(input);
|
|
28
|
-
return createHtmlPlaceholder(this.metadata, options);
|
|
27
|
+
return createImage(Buffer.from(scoreCard(options)).toString('base64'), false);
|
|
29
28
|
};
|
|
30
29
|
validate(input) {
|
|
31
30
|
return validateMacroContent(this.metadata, input);
|
|
32
31
|
}
|
|
33
|
-
createAsciidocElement(options) {
|
|
34
|
-
return `\n----\n${options.title}: ${options.value} ${options.unit ?? ''} ${options.legend ?? ''}\n----\n`;
|
|
35
|
-
}
|
|
36
32
|
}
|
|
37
33
|
export default ScoreCardMacro;
|
|
38
34
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/macros/scoreCard/index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/macros/scoreCard/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;EAYE;AAEF,OAAO,EAAE,WAAW,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAGhE,OAAO,aAAa,MAAM,eAAe,CAAC;AAC1C,OAAO,SAAS,MAAM,kBAAkB,CAAC;AAEzC,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAS/C,MAAM,cAAe,SAAQ,SAAS;IACpC,YAAY,UAAqB;QAC/B,KAAK,CAAC,aAAa,EAAE,UAAU,CAAC,CAAC;IACnC,CAAC;IACD,cAAc,GAAG,CAAC,IAAY,EAAE,EAAE;QAChC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;IACtB,CAAC,CAAC;IAEF,YAAY,GAAG,KAAK,EAAE,CAAyB,EAAE,KAAc,EAAE,EAAE;QACjE,MAAM,OAAO,GAAG,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;QACrC,OAAO,WAAW,CAChB,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,EAClD,KAAK,CACN,CAAC;IACJ,CAAC,CAAC;IAEM,QAAQ,CAAC,KAAc;QAC7B,OAAO,oBAAoB,CAAmB,IAAI,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC;IACtE,CAAC;CACF;AAED,eAAe,cAAc,CAAC"}
|