@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.
- package/LICENSE +702 -0
- package/dist/card-metadata-updater.d.ts +33 -0
- package/dist/card-metadata-updater.js +121 -0
- package/dist/card-metadata-updater.js.map +1 -0
- package/dist/command-handler.d.ts +96 -0
- package/dist/command-handler.js +557 -0
- package/dist/command-handler.js.map +1 -0
- package/dist/command-manager.d.ts +43 -0
- package/dist/command-manager.js +73 -0
- package/dist/command-manager.js.map +1 -0
- package/dist/commands/calculate.d.ts +86 -0
- package/dist/commands/calculate.js +444 -0
- package/dist/commands/calculate.js.map +1 -0
- package/dist/commands/create.d.ts +114 -0
- package/dist/commands/create.js +389 -0
- package/dist/commands/create.js.map +1 -0
- package/dist/commands/edit.d.ts +37 -0
- package/dist/commands/edit.js +99 -0
- package/dist/commands/edit.js.map +1 -0
- package/dist/commands/export-site.d.ts +45 -0
- package/dist/commands/export-site.js +301 -0
- package/dist/commands/export-site.js.map +1 -0
- package/dist/commands/export.d.ts +53 -0
- package/dist/commands/export.js +251 -0
- package/dist/commands/export.js.map +1 -0
- package/dist/commands/import.d.ts +53 -0
- package/dist/commands/import.js +133 -0
- package/dist/commands/import.js.map +1 -0
- package/dist/commands/index.d.ts +26 -0
- package/dist/commands/index.js +27 -0
- package/dist/commands/index.js.map +1 -0
- package/dist/commands/move.d.ts +55 -0
- package/dist/commands/move.js +341 -0
- package/dist/commands/move.js.map +1 -0
- package/dist/commands/remove.d.ts +38 -0
- package/dist/commands/remove.js +192 -0
- package/dist/commands/remove.js.map +1 -0
- package/dist/commands/rename.d.ts +46 -0
- package/dist/commands/rename.js +289 -0
- package/dist/commands/rename.js.map +1 -0
- package/dist/commands/show.d.ts +124 -0
- package/dist/commands/show.js +345 -0
- package/dist/commands/show.js.map +1 -0
- package/dist/commands/transition.d.ts +27 -0
- package/dist/commands/transition.js +92 -0
- package/dist/commands/transition.js.map +1 -0
- package/dist/commands/update.d.ts +29 -0
- package/dist/commands/update.js +64 -0
- package/dist/commands/update.js.map +1 -0
- package/dist/commands/validate.d.ts +143 -0
- package/dist/commands/validate.js +689 -0
- package/dist/commands/validate.js.map +1 -0
- package/dist/containers/card-container.d.ts +44 -0
- package/dist/containers/card-container.js +282 -0
- package/dist/containers/card-container.js.map +1 -0
- package/dist/containers/project/project-paths.d.ts +46 -0
- package/dist/containers/project/project-paths.js +105 -0
- package/dist/containers/project/project-paths.js.map +1 -0
- package/dist/containers/project/resource-collector.d.ts +86 -0
- package/dist/containers/project/resource-collector.js +331 -0
- package/dist/containers/project/resource-collector.js.map +1 -0
- package/dist/containers/project.d.ts +351 -0
- package/dist/containers/project.js +896 -0
- package/dist/containers/project.js.map +1 -0
- package/dist/containers/template.d.ts +108 -0
- package/dist/containers/template.js +433 -0
- package/dist/containers/template.js.map +1 -0
- package/dist/exceptions/index.d.ts +19 -0
- package/dist/exceptions/index.js +26 -0
- package/dist/exceptions/index.js.map +1 -0
- package/dist/index.d.ts +16 -0
- package/dist/index.js +15 -0
- package/dist/index.js.map +1 -0
- package/dist/interfaces/adoc.d.ts +12 -0
- package/dist/interfaces/adoc.js +13 -0
- package/dist/interfaces/adoc.js.map +1 -0
- package/dist/interfaces/macros.d.ts +45 -0
- package/dist/interfaces/macros.js +13 -0
- package/dist/interfaces/macros.js.map +1 -0
- package/dist/interfaces/project-interfaces.d.ts +121 -0
- package/dist/interfaces/project-interfaces.js +21 -0
- package/dist/interfaces/project-interfaces.js.map +1 -0
- package/dist/interfaces/request-status-interfaces.d.ts +28 -0
- package/dist/interfaces/request-status-interfaces.js +20 -0
- package/dist/interfaces/request-status-interfaces.js.map +1 -0
- package/dist/interfaces/resource-interfaces.d.ts +117 -0
- package/dist/interfaces/resource-interfaces.js +20 -0
- package/dist/interfaces/resource-interfaces.js.map +1 -0
- package/dist/macros/base-macro.d.ts +31 -0
- package/dist/macros/base-macro.js +126 -0
- package/dist/macros/base-macro.js.map +1 -0
- package/dist/macros/common.d.ts +17 -0
- package/dist/macros/common.js +23 -0
- package/dist/macros/common.js.map +1 -0
- package/dist/macros/createCards/index.d.ts +36 -0
- package/dist/macros/createCards/index.js +35 -0
- package/dist/macros/createCards/index.js.map +1 -0
- package/dist/macros/createCards/metadata.d.ts +14 -0
- package/dist/macros/createCards/metadata.js +18 -0
- package/dist/macros/createCards/metadata.js.map +1 -0
- package/dist/macros/graph/index.d.ts +29 -0
- package/dist/macros/graph/index.js +91 -0
- package/dist/macros/graph/index.js.map +1 -0
- package/dist/macros/graph/metadata.d.ts +14 -0
- package/dist/macros/graph/metadata.js +18 -0
- package/dist/macros/graph/metadata.js.map +1 -0
- package/dist/macros/index.d.ts +93 -0
- package/dist/macros/index.js +237 -0
- package/dist/macros/index.js.map +1 -0
- package/dist/macros/report/index.d.ts +26 -0
- package/dist/macros/report/index.js +70 -0
- package/dist/macros/report/index.js.map +1 -0
- package/dist/macros/report/metadata.d.ts +14 -0
- package/dist/macros/report/metadata.js +18 -0
- package/dist/macros/report/metadata.js.map +1 -0
- package/dist/macros/scoreCard/index.d.ts +30 -0
- package/dist/macros/scoreCard/index.js +38 -0
- package/dist/macros/scoreCard/index.js.map +1 -0
- package/dist/macros/scoreCard/metadata.d.ts +14 -0
- package/dist/macros/scoreCard/metadata.js +18 -0
- package/dist/macros/scoreCard/metadata.js.map +1 -0
- package/dist/macros/task-queue.d.ts +46 -0
- package/dist/macros/task-queue.js +69 -0
- package/dist/macros/task-queue.js.map +1 -0
- package/dist/module-manager.d.ts +62 -0
- package/dist/module-manager.js +350 -0
- package/dist/module-manager.js.map +1 -0
- package/dist/permissions/action-guard.d.ts +28 -0
- package/dist/permissions/action-guard.js +61 -0
- package/dist/permissions/action-guard.js.map +1 -0
- package/dist/project-settings.d.ts +42 -0
- package/dist/project-settings.js +120 -0
- package/dist/project-settings.js.map +1 -0
- package/dist/resources/array-handler.d.ts +28 -0
- package/dist/resources/array-handler.js +116 -0
- package/dist/resources/array-handler.js.map +1 -0
- package/dist/resources/card-type-resource.d.ts +72 -0
- package/dist/resources/card-type-resource.js +334 -0
- package/dist/resources/card-type-resource.js.map +1 -0
- package/dist/resources/create-defaults.d.ts +81 -0
- package/dist/resources/create-defaults.js +184 -0
- package/dist/resources/create-defaults.js.map +1 -0
- package/dist/resources/field-type-resource.d.ts +88 -0
- package/dist/resources/field-type-resource.js +411 -0
- package/dist/resources/field-type-resource.js.map +1 -0
- package/dist/resources/file-resource.d.ts +50 -0
- package/dist/resources/file-resource.js +301 -0
- package/dist/resources/file-resource.js.map +1 -0
- package/dist/resources/folder-resource.d.ts +66 -0
- package/dist/resources/folder-resource.js +100 -0
- package/dist/resources/folder-resource.js.map +1 -0
- package/dist/resources/graph-model-resource.d.ts +78 -0
- package/dist/resources/graph-model-resource.js +164 -0
- package/dist/resources/graph-model-resource.js.map +1 -0
- package/dist/resources/graph-view-resource.d.ts +78 -0
- package/dist/resources/graph-view-resource.js +163 -0
- package/dist/resources/graph-view-resource.js.map +1 -0
- package/dist/resources/link-type-resource.d.ts +62 -0
- package/dist/resources/link-type-resource.js +150 -0
- package/dist/resources/link-type-resource.js.map +1 -0
- package/dist/resources/report-resource.d.ts +77 -0
- package/dist/resources/report-resource.js +171 -0
- package/dist/resources/report-resource.js.map +1 -0
- package/dist/resources/resource-object.d.ts +108 -0
- package/dist/resources/resource-object.js +147 -0
- package/dist/resources/resource-object.js.map +1 -0
- package/dist/resources/template-resource.d.ts +82 -0
- package/dist/resources/template-resource.js +173 -0
- package/dist/resources/template-resource.js.map +1 -0
- package/dist/resources/workflow-resource.d.ts +67 -0
- package/dist/resources/workflow-resource.js +156 -0
- package/dist/resources/workflow-resource.js.map +1 -0
- package/dist/types/queries.d.ts +142 -0
- package/dist/types/queries.js +16 -0
- package/dist/types/queries.js.map +1 -0
- package/dist/utils/card-utils.d.ts +34 -0
- package/dist/utils/card-utils.js +78 -0
- package/dist/utils/card-utils.js.map +1 -0
- package/dist/utils/clingo-fact-builder.d.ts +58 -0
- package/dist/utils/clingo-fact-builder.js +126 -0
- package/dist/utils/clingo-fact-builder.js.map +1 -0
- package/dist/utils/clingo-facts.d.ts +97 -0
- package/dist/utils/clingo-facts.js +352 -0
- package/dist/utils/clingo-facts.js.map +1 -0
- package/dist/utils/clingo-parser.d.ts +59 -0
- package/dist/utils/clingo-parser.js +403 -0
- package/dist/utils/clingo-parser.js.map +1 -0
- package/dist/utils/clingo-program-builder.d.ts +39 -0
- package/dist/utils/clingo-program-builder.js +57 -0
- package/dist/utils/clingo-program-builder.js.map +1 -0
- package/dist/utils/common-utils.d.ts +24 -0
- package/dist/utils/common-utils.js +47 -0
- package/dist/utils/common-utils.js.map +1 -0
- package/dist/utils/constants.d.ts +18 -0
- package/dist/utils/constants.js +27 -0
- package/dist/utils/constants.js.map +1 -0
- package/dist/utils/csv.d.ts +18 -0
- package/dist/utils/csv.js +45 -0
- package/dist/utils/csv.js.map +1 -0
- package/dist/utils/file-utils.d.ts +69 -0
- package/dist/utils/file-utils.js +158 -0
- package/dist/utils/file-utils.js.map +1 -0
- package/dist/utils/json.d.ts +61 -0
- package/dist/utils/json.js +108 -0
- package/dist/utils/json.js.map +1 -0
- package/dist/utils/lexorank.d.ts +59 -0
- package/dist/utils/lexorank.js +159 -0
- package/dist/utils/lexorank.js.map +1 -0
- package/dist/utils/log-utils.d.ts +40 -0
- package/dist/utils/log-utils.js +109 -0
- package/dist/utils/log-utils.js.map +1 -0
- package/dist/utils/random.d.ts +19 -0
- package/dist/utils/random.js +34 -0
- package/dist/utils/random.js.map +1 -0
- package/dist/utils/resource-utils.d.ts +45 -0
- package/dist/utils/resource-utils.js +137 -0
- package/dist/utils/resource-utils.js.map +1 -0
- package/dist/utils/sanitize-svg.d.ts +18 -0
- package/dist/utils/sanitize-svg.js +38 -0
- package/dist/utils/sanitize-svg.js.map +1 -0
- package/dist/utils/user-preferences.d.ts +64 -0
- package/dist/utils/user-preferences.js +106 -0
- package/dist/utils/user-preferences.js.map +1 -0
- package/dist/utils/validate.d.ts +26 -0
- package/dist/utils/validate.js +53 -0
- package/dist/utils/validate.js.map +1 -0
- package/dist/utils/value-utils.d.ts +58 -0
- package/dist/utils/value-utils.js +181 -0
- package/dist/utils/value-utils.js.map +1 -0
- package/package.json +67 -0
- package/src/card-metadata-updater.ts +182 -0
- package/src/command-handler.ts +686 -0
- package/src/command-manager.ts +99 -0
- package/src/commands/calculate.ts +591 -0
- package/src/commands/create.ts +559 -0
- package/src/commands/edit.ts +123 -0
- package/src/commands/export-site.ts +356 -0
- package/src/commands/export.ts +315 -0
- package/src/commands/import.ts +169 -0
- package/src/commands/index.ts +42 -0
- package/src/commands/move.ts +451 -0
- package/src/commands/remove.ts +244 -0
- package/src/commands/rename.ts +378 -0
- package/src/commands/show.ts +442 -0
- package/src/commands/transition.ts +127 -0
- package/src/commands/update.ts +76 -0
- package/src/commands/validate.ts +962 -0
- package/src/containers/card-container.ts +378 -0
- package/src/containers/project/project-paths.ts +127 -0
- package/src/containers/project/resource-collector.ts +379 -0
- package/src/containers/project.ts +1135 -0
- package/src/containers/template.ts +573 -0
- package/src/exceptions/index.ts +29 -0
- package/src/index.ts +33 -0
- package/src/interfaces/adoc.ts +18 -0
- package/src/interfaces/macros.ts +54 -0
- package/src/interfaces/project-interfaces.ts +208 -0
- package/src/interfaces/request-status-interfaces.ts +30 -0
- package/src/interfaces/resource-interfaces.ts +179 -0
- package/src/macros/base-macro.ts +176 -0
- package/src/macros/common.ts +24 -0
- package/src/macros/createCards/index.ts +57 -0
- package/src/macros/createCards/metadata.ts +21 -0
- package/src/macros/graph/index.ts +130 -0
- package/src/macros/graph/metadata.ts +21 -0
- package/src/macros/index.ts +321 -0
- package/src/macros/report/index.ts +88 -0
- package/src/macros/report/metadata.ts +21 -0
- package/src/macros/scoreCard/index.ts +55 -0
- package/src/macros/scoreCard/metadata.ts +21 -0
- package/src/macros/task-queue.ts +79 -0
- package/src/module-manager.ts +443 -0
- package/src/permissions/action-guard.ts +77 -0
- package/src/project-settings.ts +140 -0
- package/src/resources/array-handler.ts +141 -0
- package/src/resources/card-type-resource.ts +455 -0
- package/src/resources/create-defaults.ts +216 -0
- package/src/resources/field-type-resource.ts +533 -0
- package/src/resources/file-resource.ts +433 -0
- package/src/resources/folder-resource.ts +140 -0
- package/src/resources/graph-model-resource.ts +205 -0
- package/src/resources/graph-view-resource.ts +199 -0
- package/src/resources/link-type-resource.ts +191 -0
- package/src/resources/report-resource.ts +224 -0
- package/src/resources/resource-object.ts +246 -0
- package/src/resources/template-resource.ts +210 -0
- package/src/resources/workflow-resource.ts +205 -0
- package/src/types/queries.ts +149 -0
- package/src/utils/card-utils.ts +83 -0
- package/src/utils/clingo-fact-builder.ts +167 -0
- package/src/utils/clingo-facts.ts +550 -0
- package/src/utils/clingo-parser.ts +519 -0
- package/src/utils/clingo-program-builder.ts +71 -0
- package/src/utils/common-utils.ts +54 -0
- package/src/utils/constants.ts +32 -0
- package/src/utils/csv.ts +53 -0
- package/src/utils/file-utils.ts +182 -0
- package/src/utils/json.ts +118 -0
- package/src/utils/lexorank.ts +180 -0
- package/src/utils/log-utils.ts +127 -0
- package/src/utils/random.ts +37 -0
- package/src/utils/resource-utils.ts +180 -0
- package/src/utils/sanitize-svg.ts +46 -0
- package/src/utils/user-preferences.ts +126 -0
- package/src/utils/validate.ts +66 -0
- package/src/utils/value-utils.ts +189 -0
|
@@ -0,0 +1,237 @@
|
|
|
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 Handlebars from 'handlebars';
|
|
13
|
+
import createCards from './createCards/index.js';
|
|
14
|
+
import graph from './graph/index.js';
|
|
15
|
+
import report from './report/index.js';
|
|
16
|
+
import scoreCard from './scoreCard/index.js';
|
|
17
|
+
import { validateJson } from '../utils/validate.js';
|
|
18
|
+
import { DHValidationError } from '../exceptions/index.js';
|
|
19
|
+
import TaskQueue from './task-queue.js';
|
|
20
|
+
const CURLY_LEFT = '{';
|
|
21
|
+
const CURLY_RIGHT = '}';
|
|
22
|
+
export const macros = {
|
|
23
|
+
createCards,
|
|
24
|
+
graph,
|
|
25
|
+
report,
|
|
26
|
+
scoreCard,
|
|
27
|
+
};
|
|
28
|
+
export function validateMacroContent(macro, data, validator) {
|
|
29
|
+
if (!macro.schema) {
|
|
30
|
+
throw new Error(`Macro ${macro.name} does not have a schema`);
|
|
31
|
+
}
|
|
32
|
+
try {
|
|
33
|
+
return validateJson(data, {
|
|
34
|
+
schemaId: macro.schema,
|
|
35
|
+
validator,
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
catch (error) {
|
|
39
|
+
let message = `Error: ${error instanceof Error ? error.message : 'Unknown error'}`;
|
|
40
|
+
if (error instanceof DHValidationError) {
|
|
41
|
+
message = `${error.errors?.map((e) => e.message).join(', ')}`;
|
|
42
|
+
}
|
|
43
|
+
throw new Error(`${macro.name} macro JSON validation error: ${message}`);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Registers the macros with Handlebars
|
|
48
|
+
* @param {Mode} mode - The mode to register the macros in
|
|
49
|
+
*/
|
|
50
|
+
export function registerMacros(instance, context, tasks) {
|
|
51
|
+
const macroInstances = [];
|
|
52
|
+
for (const macro of Object.keys(macros)) {
|
|
53
|
+
const MacroClass = macros[macro];
|
|
54
|
+
const macroInstance = new MacroClass(tasks);
|
|
55
|
+
instance.registerHelper(macro, function (options) {
|
|
56
|
+
if (this != null &&
|
|
57
|
+
typeof this === 'object' &&
|
|
58
|
+
'__isRaw' in this &&
|
|
59
|
+
this.__isRaw) {
|
|
60
|
+
// we use escaped chars so that they will not be re-run
|
|
61
|
+
return `${CURLY_LEFT}${CURLY_LEFT}#${macro}${CURLY_RIGHT}${CURLY_RIGHT}${options.fn(this)}${CURLY_LEFT}${CURLY_LEFT}/${macro}${CURLY_RIGHT}${CURLY_RIGHT}`;
|
|
62
|
+
}
|
|
63
|
+
return macroInstance.invokeMacro(context, options);
|
|
64
|
+
});
|
|
65
|
+
macroInstances.push(macroInstance);
|
|
66
|
+
}
|
|
67
|
+
instance.registerHelper('raw', function (options) {
|
|
68
|
+
return options.fn({
|
|
69
|
+
__isRaw: true,
|
|
70
|
+
});
|
|
71
|
+
});
|
|
72
|
+
return macroInstances;
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Calculate amount of handlebars templates inside a string
|
|
76
|
+
* @param input
|
|
77
|
+
*/
|
|
78
|
+
export function macroCount(input) {
|
|
79
|
+
const regex = /{{#[\w\s-]+?}}/g;
|
|
80
|
+
const match = input.match(regex);
|
|
81
|
+
return match ? match.length : 0;
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Registers macros as handlebars helpers, which just leaves the macros in the content
|
|
85
|
+
* Can be used when your macro uses handlebars and handles content that might contain macros
|
|
86
|
+
* The handleMacros function will handle recursive macros so do not execute them inside your macro
|
|
87
|
+
* @param instance handlebars instance
|
|
88
|
+
*/
|
|
89
|
+
export function registerEmptyMacros(instance) {
|
|
90
|
+
for (const macro of Object.keys(macros)) {
|
|
91
|
+
instance.registerHelper(macro, function (options) {
|
|
92
|
+
return `{{#${macro}}}${options.fn(this)}{{/${macro}}}`;
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* Handle the macros in the content
|
|
98
|
+
* @param content - The content to handle the macros in
|
|
99
|
+
* @param mode - The mode to handle the macros in. Inject mode will generate injectable placeholders for the macros while static mode will generate valid adoc. Validate mode will only validate the macros syntax and throw errors in case of issues.
|
|
100
|
+
*/
|
|
101
|
+
export async function evaluateMacros(content, context, maxTries = 10) {
|
|
102
|
+
const handlebars = Handlebars.create();
|
|
103
|
+
const tasks = new TaskQueue();
|
|
104
|
+
registerMacros(handlebars, context, tasks);
|
|
105
|
+
let result = content;
|
|
106
|
+
while (maxTries-- > 0) {
|
|
107
|
+
tasks.reset();
|
|
108
|
+
const compiled = handlebars.compile(result, {
|
|
109
|
+
strict: true,
|
|
110
|
+
});
|
|
111
|
+
try {
|
|
112
|
+
result = compiled({});
|
|
113
|
+
await tasks.waitAll();
|
|
114
|
+
result = applyMacroResults(result, tasks, context);
|
|
115
|
+
if (macroCount(result) === 0) {
|
|
116
|
+
break;
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
catch (err) {
|
|
120
|
+
// This will produce a warning in the output in inject/static modes and throw an error in validate mode
|
|
121
|
+
return handleMacroError(err, '', context);
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
if (macroCount(result) !== 0) {
|
|
125
|
+
return handleMacroError(new Error(`Too many recursive macro evaluations.`), '', context);
|
|
126
|
+
}
|
|
127
|
+
return result.replaceAll(CURLY_LEFT, '{').replaceAll(CURLY_RIGHT, '}');
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* This function assumes that tasks, which were started by macros, are complete.
|
|
131
|
+
* It replaces the placeholders of the tasks with the actual results
|
|
132
|
+
* @param input Adoc content, which might have macro placeholders
|
|
133
|
+
* @param tasks The taskqueue, which was used to run the macros
|
|
134
|
+
* @param context General context for the macro evaluation process
|
|
135
|
+
* @returns Adoc, where placeholders have been replaced with the results.
|
|
136
|
+
* Note that the results might include new macros.
|
|
137
|
+
*/
|
|
138
|
+
export function applyMacroResults(input, tasks, context) {
|
|
139
|
+
for (const item of tasks) {
|
|
140
|
+
if (item.promiseResult === null) {
|
|
141
|
+
input = handleMacroError(new Error(`Tried to access result before it was resolved for ${item.placeholder}`), item.macro, context);
|
|
142
|
+
}
|
|
143
|
+
else {
|
|
144
|
+
input = input.replace(item.placeholder, item.promiseResult);
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
return input;
|
|
148
|
+
}
|
|
149
|
+
/**
|
|
150
|
+
* Handles errors that come when handling macros
|
|
151
|
+
* @param error - The error that was thrown
|
|
152
|
+
* @param macro - The macro that caused the error
|
|
153
|
+
* @returns The error message that is valid adoc
|
|
154
|
+
*/
|
|
155
|
+
export function handleMacroError(error, macro, context) {
|
|
156
|
+
let message = `Error: ${error instanceof Error ? error.message : 'Unknown error'}`;
|
|
157
|
+
if (error instanceof DHValidationError) {
|
|
158
|
+
message = `Check json syntax of macro ${macro}: ${error.errors?.map((e) => e.message).join(', ')}`;
|
|
159
|
+
}
|
|
160
|
+
if (typeof error === 'object' &&
|
|
161
|
+
error != null &&
|
|
162
|
+
'lineNumber' in error &&
|
|
163
|
+
typeof error.lineNumber === 'number') {
|
|
164
|
+
message += ` at line ${error.lineNumber}`;
|
|
165
|
+
}
|
|
166
|
+
if (context.mode === 'validate') {
|
|
167
|
+
throw new Error(message);
|
|
168
|
+
}
|
|
169
|
+
else {
|
|
170
|
+
return createAdmonition('WARNING', 'Macro Error', message);
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
// This is used to generate unique keys for macros
|
|
174
|
+
// There might be a better way to do this
|
|
175
|
+
let macroCounter = 0;
|
|
176
|
+
/**
|
|
177
|
+
* Creates an injectable placeholder for a macro
|
|
178
|
+
* @param macro - The macro to create the placeholder for
|
|
179
|
+
* @param options - Options will be passed to the html element as attributes
|
|
180
|
+
*/
|
|
181
|
+
export function createHtmlPlaceholder(macro, options) {
|
|
182
|
+
// Flatten nested objects into dot notation attributes
|
|
183
|
+
const flattenedOptions = {};
|
|
184
|
+
// Helper function to flatten nested objects
|
|
185
|
+
const flatten = (obj, prefix = '') => {
|
|
186
|
+
Object.entries(obj).forEach(([key, value]) => {
|
|
187
|
+
const newKey = prefix ? `${prefix}.${key}` : key;
|
|
188
|
+
if (value !== null &&
|
|
189
|
+
typeof value === 'object' &&
|
|
190
|
+
!Array.isArray(value)) {
|
|
191
|
+
// Recursively flatten nested objects
|
|
192
|
+
flatten(value, newKey);
|
|
193
|
+
}
|
|
194
|
+
else {
|
|
195
|
+
// Add leaf values to flattened options
|
|
196
|
+
flattenedOptions[newKey] = value;
|
|
197
|
+
}
|
|
198
|
+
});
|
|
199
|
+
};
|
|
200
|
+
flatten(options);
|
|
201
|
+
// Convert flattened options to attribute strings
|
|
202
|
+
const attributeStrings = Object.entries(flattenedOptions)
|
|
203
|
+
.filter(([, value]) => value !== undefined)
|
|
204
|
+
.map(([key, value]) => `${key}="${value}"`);
|
|
205
|
+
const optionString = attributeStrings.join(' ');
|
|
206
|
+
// start with a line change to ensure that inline passthrough +++ is on its own line
|
|
207
|
+
return `\n+++\n<${macro.tagName}${optionString ? ` ${optionString}` : ''} key="macro-${macroCounter++}"></${macro.tagName}>\n+++\n`;
|
|
208
|
+
}
|
|
209
|
+
/**
|
|
210
|
+
* Creates an adoc admonition
|
|
211
|
+
* @param type - The type of admonition
|
|
212
|
+
* @param label - The label of the admonition
|
|
213
|
+
* @param content - The content of the admonition
|
|
214
|
+
* @returns The adoc admonition as a string
|
|
215
|
+
*/
|
|
216
|
+
export function createAdmonition(type, label, content) {
|
|
217
|
+
return `[${type}]\n.${label}\n====\n${content}\n====\n\n`;
|
|
218
|
+
}
|
|
219
|
+
/**
|
|
220
|
+
* Helper function for including base64 encoded images for now
|
|
221
|
+
* @param image base64 encoded image
|
|
222
|
+
* @returns valid asciidoc with the image
|
|
223
|
+
*/
|
|
224
|
+
export function createImage(image) {
|
|
225
|
+
if (process.env.EXPORT_FORMAT) {
|
|
226
|
+
return `image::data:image/svg+xml;base64,${image}[]\n`;
|
|
227
|
+
}
|
|
228
|
+
else {
|
|
229
|
+
return `++++
|
|
230
|
+
<div class="cyberismo-svg-wrapper" data-type="cyberismo-svg-wrapper">
|
|
231
|
+
${Buffer.from(image, 'base64').toString('utf-8')}
|
|
232
|
+
</div>
|
|
233
|
+
++++
|
|
234
|
+
`;
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/macros/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;EAUE;AAEF,OAAO,UAAU,MAAM,YAAY,CAAC;AAEpC,OAAO,WAAW,MAAM,wBAAwB,CAAC;AACjD,OAAO,KAAK,MAAM,kBAAkB,CAAC;AACrC,OAAO,MAAM,MAAM,mBAAmB,CAAC;AACvC,OAAO,SAAS,MAAM,sBAAsB,CAAC;AAE7C,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACpD,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAS3D,OAAO,SAAS,MAAM,iBAAiB,CAAC;AAExC,MAAM,UAAU,GAAG,QAAQ,CAAC;AAC5B,MAAM,WAAW,GAAG,QAAQ,CAAC;AAM7B,MAAM,CAAC,MAAM,MAAM,GAA2C;IAC5D,WAAW;IACX,KAAK;IACL,MAAM;IACN,SAAS;CACV,CAAC;AAEF,MAAM,UAAU,oBAAoB,CAClC,KAAoB,EACpB,IAAa,EACb,SAAqB;IAErB,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE,CAAC;QAClB,MAAM,IAAI,KAAK,CAAC,SAAS,KAAK,CAAC,IAAI,yBAAyB,CAAC,CAAC;IAChE,CAAC;IAED,IAAI,CAAC;QACH,OAAO,YAAY,CAAI,IAAI,EAAE;YAC3B,QAAQ,EAAE,KAAK,CAAC,MAAM;YACtB,SAAS;SACV,CAAC,CAAC;IACL,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,IAAI,OAAO,GAAG,UAAU,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OA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C,aAAa,EAAE,CAAC;QAC9B,OAAO,oCAAoC,KAAK,MAAM,CAAC;IACzD,CAAC;SAAM,CAAC;QACN,OAAO;;EAET,MAAM,CAAC,IAAI,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC,QAAQ,CAAC,OAAO,CAAC;;;CAG/C,CAAC;IACA,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
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 { MacroOptions } from '../index.js';
|
|
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 ReportOptions extends MacroOptions {
|
|
17
|
+
name: string;
|
|
18
|
+
}
|
|
19
|
+
declare class ReportMacro extends BaseMacro {
|
|
20
|
+
constructor(tasksQueue: TaskQueue);
|
|
21
|
+
handleValidate: (input: unknown) => void;
|
|
22
|
+
handleStatic: (context: MacroGenerationContext, data: unknown) => Promise<string>;
|
|
23
|
+
handleInject: (context: MacroGenerationContext, data: unknown) => Promise<string>;
|
|
24
|
+
private validate;
|
|
25
|
+
}
|
|
26
|
+
export default ReportMacro;
|
|
@@ -0,0 +1,70 @@
|
|
|
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 { registerEmptyMacros, validateMacroContent } from '../index.js';
|
|
13
|
+
import macroMetadata from './metadata.js';
|
|
14
|
+
import { Project } from '../../containers/project.js';
|
|
15
|
+
import { Calculate } from '../../commands/index.js';
|
|
16
|
+
import Handlebars from 'handlebars';
|
|
17
|
+
import BaseMacro from '../base-macro.js';
|
|
18
|
+
import { validateJson } from '../../utils/validate.js';
|
|
19
|
+
import { ReportResource } from '../../resources/report-resource.js';
|
|
20
|
+
import { resourceName } from '../../utils/resource-utils.js';
|
|
21
|
+
class ReportMacro extends BaseMacro {
|
|
22
|
+
constructor(tasksQueue) {
|
|
23
|
+
super(macroMetadata, tasksQueue);
|
|
24
|
+
}
|
|
25
|
+
handleValidate = (input) => {
|
|
26
|
+
this.validate(input);
|
|
27
|
+
};
|
|
28
|
+
handleStatic = async (context, data) => {
|
|
29
|
+
return this.handleInject(context, data);
|
|
30
|
+
};
|
|
31
|
+
handleInject = async (context, data) => {
|
|
32
|
+
const options = this.validate(data);
|
|
33
|
+
const project = new Project(context.projectPath);
|
|
34
|
+
const resource = new ReportResource(project, resourceName(options.name));
|
|
35
|
+
const report = await resource.show();
|
|
36
|
+
if (!report)
|
|
37
|
+
throw new Error(`Report ${options} does not exist`);
|
|
38
|
+
if (report.schema) {
|
|
39
|
+
validateJson(options, {
|
|
40
|
+
schema: report.schema,
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
const handlebarsContext = {
|
|
44
|
+
cardKey: context.cardKey,
|
|
45
|
+
...options,
|
|
46
|
+
};
|
|
47
|
+
const handlebars = Handlebars.create();
|
|
48
|
+
const template = handlebars.compile(report.queryTemplate, {
|
|
49
|
+
strict: true,
|
|
50
|
+
});
|
|
51
|
+
const calculate = new Calculate(project);
|
|
52
|
+
const result = await calculate.runLogicProgram({
|
|
53
|
+
query: template(handlebarsContext),
|
|
54
|
+
});
|
|
55
|
+
if (result.error) {
|
|
56
|
+
throw new Error(result.error);
|
|
57
|
+
}
|
|
58
|
+
// register empty macros so that other macros aren't touched yet
|
|
59
|
+
registerEmptyMacros(handlebars);
|
|
60
|
+
return handlebars.compile(report.contentTemplate)({
|
|
61
|
+
...handlebarsContext,
|
|
62
|
+
...result,
|
|
63
|
+
});
|
|
64
|
+
};
|
|
65
|
+
validate(data) {
|
|
66
|
+
return validateMacroContent(this.metadata, data);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
export default ReportMacro;
|
|
70
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/macros/report/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;EAUE;AAEF,OAAO,EAAE,mBAAmB,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAGxE,OAAO,aAAa,MAAM,eAAe,CAAC;AAC1C,OAAO,EAAE,OAAO,EAAE,MAAM,6BAA6B,CAAC;AACtD,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AACpD,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,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;AAM7D,MAAM,WAAY,SAAQ,SAAS;IACjC,Y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C,CAAC;QACzC,MAAM,MAAM,GAAG,MAAM,SAAS,CAAC,eAAe,CAAC;YAC7C,KAAK,EAAE,QAAQ,CAAC,iBAAiB,CAAC;SACnC,CAAC,CAAC;QACH,IAAI,MAAM,CAAC,KAAK,EAAE,CAAC;YACjB,MAAM,IAAI,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;QAChC,CAAC;QACD,gEAAgE;QAChE,mBAAmB,CAAC,UAAU,CAAC,CAAC;QAEhC,OAAO,UAAU,CAAC,OAAO,CAAC,MAAM,CAAC,eAAe,CAAC,CAAC;YAChD,GAAG,iBAAiB;YACpB,GAAG,MAAM;SACV,CAAC,CAAC;IACL,CAAC,CAAC;IAEM,QAAQ,CAAC,IAAa;QAC5B,OAAO,oBAAoB,CAAgB,IAAI,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;IAClE,CAAC;CACF;AAED,eAAe,WAAW,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
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 { MacroMetadata } from '../../interfaces/macros.js';
|
|
13
|
+
declare const macroMetadata: MacroMetadata;
|
|
14
|
+
export default macroMetadata;
|
|
@@ -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
|
+
const macroMetadata = {
|
|
13
|
+
name: 'report',
|
|
14
|
+
tagName: 'report',
|
|
15
|
+
schema: 'reportMacroBaseSchema',
|
|
16
|
+
};
|
|
17
|
+
export default macroMetadata;
|
|
18
|
+
//# sourceMappingURL=metadata.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"metadata.js","sourceRoot":"","sources":["../../../src/macros/report/metadata.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;EAUE;AAIF,MAAM,aAAa,GAAkB;IACnC,IAAI,EAAE,QAAQ;IACd,OAAO,EAAE,QAAQ;IACjB,MAAM,EAAE,uBAAuB;CAChC,CAAC;AAEF,eAAe,aAAa,CAAC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
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 { MacroOptions } from '../index.js';
|
|
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 ScoreCardOptions extends MacroOptions {
|
|
17
|
+
title?: string;
|
|
18
|
+
value: number;
|
|
19
|
+
unit?: string;
|
|
20
|
+
legend?: string;
|
|
21
|
+
}
|
|
22
|
+
declare class ScoreCardMacro extends BaseMacro {
|
|
23
|
+
constructor(tasksQueue: TaskQueue);
|
|
24
|
+
handleValidate: (data: string) => void;
|
|
25
|
+
handleStatic: (context: MacroGenerationContext, input: unknown) => Promise<string>;
|
|
26
|
+
handleInject: (_: MacroGenerationContext, input: unknown) => Promise<string>;
|
|
27
|
+
private validate;
|
|
28
|
+
private createAsciidocElement;
|
|
29
|
+
}
|
|
30
|
+
export default ScoreCardMacro;
|
|
@@ -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 { createHtmlPlaceholder, validateMacroContent } from '../index.js';
|
|
13
|
+
import macroMetadata from './metadata.js';
|
|
14
|
+
import BaseMacro from '../base-macro.js';
|
|
15
|
+
class ScoreCardMacro extends BaseMacro {
|
|
16
|
+
constructor(tasksQueue) {
|
|
17
|
+
super(macroMetadata, tasksQueue);
|
|
18
|
+
}
|
|
19
|
+
handleValidate = (data) => {
|
|
20
|
+
this.validate(data);
|
|
21
|
+
};
|
|
22
|
+
handleStatic = async (context, input) => {
|
|
23
|
+
const options = this.validate(input);
|
|
24
|
+
return this.createAsciidocElement(options);
|
|
25
|
+
};
|
|
26
|
+
handleInject = async (_, input) => {
|
|
27
|
+
const options = this.validate(input);
|
|
28
|
+
return createHtmlPlaceholder(this.metadata, options);
|
|
29
|
+
};
|
|
30
|
+
validate(input) {
|
|
31
|
+
return validateMacroContent(this.metadata, input);
|
|
32
|
+
}
|
|
33
|
+
createAsciidocElement(options) {
|
|
34
|
+
return `\n----\n${options.title}: ${options.value} ${options.unit ?? ''} ${options.legend ?? ''}\n----\n`;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
export default ScoreCardMacro;
|
|
38
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/macros/scoreCard/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;EAUE;AAGF,OAAO,EAAE,qBAAqB,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAG1E,OAAO,aAAa,MAAM,eAAe,CAAC;AAC1C,OAAO,SAAS,MAAM,kBAAkB,CAAC;AAUzC,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,OAA+B,EAAE,KAAc,EAAE,EAAE;QACvE,MAAM,OAAO,GAAG,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;QACrC,OAAO,IAAI,CAAC,qBAAqB,CAAC,OAAO,CAAC,CAAC;IAC7C,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,qBAAqB,CAAC,IAAI,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;IACvD,CAAC,CAAC;IAEM,QAAQ,CAAC,KAAc;QAC7B,OAAO,oBAAoB,CAAmB,IAAI,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC;IACtE,CAAC;IAEO,qBAAqB,CAAC,OAAyB;QACrD,OAAO,WAAW,OAAO,CAAC,KAAK,KAAK,OAAO,CAAC,KAAK,IAAI,OAAO,CAAC,IAAI,IAAI,EAAE,IAAI,OAAO,CAAC,MAAM,IAAI,EAAE,UAAU,CAAC;IAC5G,CAAC;CACF;AAED,eAAe,cAAc,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
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 { MacroMetadata } from '../../interfaces/macros.js';
|
|
13
|
+
declare const macroMetadata: MacroMetadata;
|
|
14
|
+
export default macroMetadata;
|
|
@@ -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
|
+
const macroMetadata = {
|
|
13
|
+
name: 'scoreCard',
|
|
14
|
+
tagName: 'score-card',
|
|
15
|
+
schema: 'scoreCardMacroSchema',
|
|
16
|
+
};
|
|
17
|
+
export default macroMetadata;
|
|
18
|
+
//# sourceMappingURL=metadata.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"metadata.js","sourceRoot":"","sources":["../../../src/macros/scoreCard/metadata.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;EAUE;AAIF,MAAM,aAAa,GAAkB;IACnC,IAAI,EAAE,WAAW;IACjB,OAAO,EAAE,YAAY;IACrB,MAAM,EAAE,sBAAsB;CAC/B,CAAC;AAEF,eAAe,aAAa,CAAC"}
|
|
@@ -0,0 +1,46 @@
|
|
|
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 { MacroTaskState } from '../interfaces/macros.js';
|
|
13
|
+
export default class TaskQueue {
|
|
14
|
+
private tasks;
|
|
15
|
+
/**
|
|
16
|
+
* Pushes a task to the task queue
|
|
17
|
+
* @param task The task to push
|
|
18
|
+
*/
|
|
19
|
+
push(task: MacroTaskState): void;
|
|
20
|
+
/**
|
|
21
|
+
* Finds an existing task based on its id
|
|
22
|
+
* @param globalId unique id across both macro classes and instances
|
|
23
|
+
* @param localId Id within the instance
|
|
24
|
+
* @returns task if found else undefined
|
|
25
|
+
*/
|
|
26
|
+
find(globalId: string, localId: number): MacroTaskState | undefined;
|
|
27
|
+
/**
|
|
28
|
+
* Waits for all tasks to be done
|
|
29
|
+
*/
|
|
30
|
+
waitAll(): Promise<void>;
|
|
31
|
+
/**
|
|
32
|
+
* Waits for a single task to be done
|
|
33
|
+
* @param task task to wait
|
|
34
|
+
*/
|
|
35
|
+
waitTask(task: MacroTaskState): Promise<void>;
|
|
36
|
+
/**
|
|
37
|
+
* Removes all tasks. If they are running, they continue to run because they are promises
|
|
38
|
+
*/
|
|
39
|
+
reset(): Promise<void>;
|
|
40
|
+
/**
|
|
41
|
+
* When iterating over task queue, it'll return each task
|
|
42
|
+
*/
|
|
43
|
+
[Symbol.iterator](): {
|
|
44
|
+
next(): IteratorResult<MacroTaskState>;
|
|
45
|
+
};
|
|
46
|
+
}
|
|
@@ -0,0 +1,69 @@
|
|
|
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
|
+
export default class TaskQueue {
|
|
13
|
+
tasks = [];
|
|
14
|
+
/**
|
|
15
|
+
* Pushes a task to the task queue
|
|
16
|
+
* @param task The task to push
|
|
17
|
+
*/
|
|
18
|
+
push(task) {
|
|
19
|
+
this.tasks.push(task);
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Finds an existing task based on its id
|
|
23
|
+
* @param globalId unique id across both macro classes and instances
|
|
24
|
+
* @param localId Id within the instance
|
|
25
|
+
* @returns task if found else undefined
|
|
26
|
+
*/
|
|
27
|
+
find(globalId, localId) {
|
|
28
|
+
return this.tasks.find((task) => task.globalId === globalId && task.localId === localId);
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Waits for all tasks to be done
|
|
32
|
+
*/
|
|
33
|
+
async waitAll() {
|
|
34
|
+
for (const task of this.tasks) {
|
|
35
|
+
await task.promise;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Waits for a single task to be done
|
|
40
|
+
* @param task task to wait
|
|
41
|
+
*/
|
|
42
|
+
async waitTask(task) {
|
|
43
|
+
await task.promise;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Removes all tasks. If they are running, they continue to run because they are promises
|
|
47
|
+
*/
|
|
48
|
+
async reset() {
|
|
49
|
+
this.tasks = [];
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* When iterating over task queue, it'll return each task
|
|
53
|
+
*/
|
|
54
|
+
[Symbol.iterator]() {
|
|
55
|
+
let index = 0;
|
|
56
|
+
const tasks = this.tasks;
|
|
57
|
+
return {
|
|
58
|
+
next() {
|
|
59
|
+
if (index < tasks.length) {
|
|
60
|
+
return { value: tasks[index++], done: false };
|
|
61
|
+
}
|
|
62
|
+
else {
|
|
63
|
+
return { value: undefined, done: true };
|
|
64
|
+
}
|
|
65
|
+
},
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
//# sourceMappingURL=task-queue.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"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