@cyberismo/data-handler 0.0.7 → 0.0.9
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 +7 -4
- package/dist/commands/create.js +42 -15
- package/dist/commands/create.js.map +1 -1
- package/dist/commands/edit.d.ts +9 -3
- package/dist/commands/edit.js +33 -9
- package/dist/commands/edit.js.map +1 -1
- package/dist/commands/export.d.ts +13 -11
- 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 +21 -2
- 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 +2 -4
- package/dist/commands/remove.js +8 -16
- 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 +85 -7
- 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 -8
- package/dist/commands/validate.js +30 -35
- 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.d.ts +2 -1
- package/dist/containers/project/resource-collector.js +41 -33
- package/dist/containers/project/resource-collector.js.map +1 -1
- package/dist/containers/project.d.ts +18 -6
- package/dist/containers/project.js +37 -72
- 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/exceptions/index.d.ts +20 -0
- package/dist/exceptions/index.js +16 -0
- package/dist/exceptions/index.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 +7 -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 +1 -1
- package/dist/interfaces/resource-interfaces.js.map +1 -1
- package/dist/macros/base-macro.d.ts +2 -0
- package/dist/macros/base-macro.js +66 -19
- 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 +1 -2
- package/dist/macros/createCards/index.js.map +1 -1
- package/dist/macros/graph/index.d.ts +1 -3
- package/dist/macros/graph/index.js +11 -9
- package/dist/macros/graph/index.js.map +1 -1
- package/dist/macros/image/index.d.ts +39 -0
- package/dist/macros/image/index.js +78 -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 +32 -0
- package/dist/macros/include/index.js +97 -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 +39 -31
- package/dist/macros/index.js +167 -73
- package/dist/macros/index.js.map +1 -1
- package/dist/macros/percentage/index.d.ts +29 -0
- package/dist/macros/percentage/index.js +36 -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 -5
- package/dist/macros/report/index.js +20 -12
- package/dist/macros/report/index.js.map +1 -1
- package/dist/macros/scoreCard/index.d.ts +15 -15
- package/dist/macros/scoreCard/index.js +16 -17
- 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 +27 -0
- package/dist/macros/vegalite/index.js +27 -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 +17 -4
- package/dist/module-manager.js +192 -58
- 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/project-settings.js +2 -8
- package/dist/project-settings.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 +9 -0
- 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 +1 -0
- package/dist/utils/resource-utils.js +9 -0
- 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 +53 -16
- package/src/commands/edit.ts +53 -11
- package/src/commands/export.ts +108 -34
- package/src/commands/import.ts +31 -2
- package/src/commands/move.ts +12 -15
- package/src/commands/remove.ts +10 -19
- package/src/commands/rename.ts +3 -12
- package/src/commands/show.ts +121 -8
- package/src/commands/transition.ts +3 -7
- package/src/commands/update.ts +6 -0
- package/src/commands/validate.ts +39 -47
- package/src/containers/card-container.ts +74 -0
- package/src/containers/project/calculation-engine.ts +535 -0
- package/src/containers/project/resource-collector.ts +45 -26
- package/src/containers/project.ts +66 -84
- package/src/containers/template.ts +16 -0
- package/src/exceptions/index.ts +36 -0
- package/src/index.ts +13 -2
- package/src/interfaces/macros.ts +7 -1
- package/src/interfaces/project-interfaces.ts +27 -0
- package/src/interfaces/resource-interfaces.ts +1 -0
- package/src/macros/base-macro.ts +89 -25
- package/src/macros/common.ts +22 -9
- package/src/macros/createCards/index.ts +1 -2
- package/src/macros/graph/index.ts +17 -12
- package/src/macros/image/index.ts +121 -0
- package/src/macros/image/metadata.ts +25 -0
- package/src/macros/include/index.ts +147 -0
- package/src/macros/include/metadata.ts +22 -0
- package/src/macros/index.ts +179 -100
- package/src/macros/percentage/index.ts +54 -0
- package/src/macros/percentage/metadata.ts +22 -0
- package/src/macros/report/index.ts +22 -17
- package/src/macros/scoreCard/index.ts +23 -23
- package/src/macros/vega/index.ts +55 -0
- package/src/macros/vega/metadata.ts +21 -0
- package/src/macros/vegalite/index.ts +50 -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 +241 -69
- package/src/permissions/action-guard.ts +3 -3
- package/src/project-settings.ts +2 -11
- 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 +14 -0
- 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 +9 -0
- package/src/utils/user-preferences.ts +32 -14
- package/src/utils/validate.ts +3 -3
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,C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Q,EAAE,CAAC;YACb,OAAO,gFAAgF,GAAG,kBAAkB,CAAC;QAC/G,CAAC;aAAM,CAAC;YACN,OAAO,SAAS,GAAG,UAAU,CAAC;QAChC,CAAC;IACH,CAAC;AACH,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,WAAW,CAAC,KAAgB,EAAE,OAAgB;IAC5D,IAAI,aAAa,GAAG,IAAI,CAAC,SAAS,CAAC,OAAO,EAAE,IAAI,EAAE,CAAC,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,29 @@
|
|
|
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
|
+
handleInject: (context: MacroGenerationContext, input: unknown) => Promise<string>;
|
|
27
|
+
private validate;
|
|
28
|
+
}
|
|
29
|
+
export default PercentageMacro;
|
|
@@ -0,0 +1,36 @@
|
|
|
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
|
+
handleInject = async (context, input) => {
|
|
29
|
+
return this.handleStatic(context, input);
|
|
30
|
+
};
|
|
31
|
+
validate(input) {
|
|
32
|
+
return validateMacroContent(this.metadata, input);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
export default PercentageMacro;
|
|
36
|
+
//# 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;IAEF,YAAY,GAAG,KAAK,EAAE,OAA+B,EAAE,KAAc,EAAE,EAAE;QACvE,OAAO,IAAI,CAAC,YAAY,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;IAC3C,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,17 +10,14 @@
|
|
|
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
23
|
handleInject: (context: MacroGenerationContext, data: unknown) => Promise<string>;
|
|
@@ -17,11 +17,10 @@ import { validateJson } from '../../utils/validate.js';
|
|
|
17
17
|
import { ReportResource } from '../../resources/report-resource.js';
|
|
18
18
|
import { resourceName } from '../../utils/resource-utils.js';
|
|
19
19
|
import { generateReportContent } from '../../utils/report.js';
|
|
20
|
+
import { ClingoError } from '@cyberismo/node-clingo';
|
|
20
21
|
class ReportMacro extends BaseMacro {
|
|
21
|
-
|
|
22
|
-
constructor(tasks, calculate) {
|
|
22
|
+
constructor(tasks) {
|
|
23
23
|
super(macroMetadata, tasks);
|
|
24
|
-
this.calculate = calculate;
|
|
25
24
|
}
|
|
26
25
|
handleValidate = (input) => {
|
|
27
26
|
this.validate(input);
|
|
@@ -40,15 +39,24 @@ class ReportMacro extends BaseMacro {
|
|
|
40
39
|
schema: report.schema,
|
|
41
40
|
});
|
|
42
41
|
}
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
42
|
+
try {
|
|
43
|
+
return await generateReportContent({
|
|
44
|
+
calculate: context.project.calculationEngine,
|
|
45
|
+
contentTemplate: report.contentTemplate,
|
|
46
|
+
queryTemplate: report.queryTemplate,
|
|
47
|
+
options: {
|
|
48
|
+
cardKey: context.cardKey,
|
|
49
|
+
...options,
|
|
50
|
+
},
|
|
51
|
+
context: context.context,
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
catch (error) {
|
|
55
|
+
if (error instanceof ClingoError) {
|
|
56
|
+
throw new Error(`Error running logic program in report '${options.name}':${error.details.errors.join('\n')}`);
|
|
57
|
+
}
|
|
58
|
+
throw error;
|
|
59
|
+
}
|
|
52
60
|
};
|
|
53
61
|
validate(data) {
|
|
54
62
|
return validateMacroContent(this.metadata, data);
|
|
@@ -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,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,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,30 @@
|
|
|
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: (
|
|
26
|
+
handleStatic: (_: MacroGenerationContext, input: unknown) => Promise<string>;
|
|
27
|
+
handleInject: (context: MacroGenerationContext, input: unknown) => Promise<string>;
|
|
27
28
|
private validate;
|
|
28
|
-
private createAsciidocElement;
|
|
29
29
|
}
|
|
30
30
|
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,16 @@ 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
|
|
27
|
+
return createImage(Buffer.from(scoreCard(options)).toString('base64'), false);
|
|
25
28
|
};
|
|
26
|
-
handleInject = async (
|
|
27
|
-
|
|
28
|
-
return createHtmlPlaceholder(this.metadata, options);
|
|
29
|
+
handleInject = async (context, input) => {
|
|
30
|
+
return this.handleStatic(context, input);
|
|
29
31
|
};
|
|
30
32
|
validate(input) {
|
|
31
33
|
return validateMacroContent(this.metadata, input);
|
|
32
34
|
}
|
|
33
|
-
createAsciidocElement(options) {
|
|
34
|
-
return `\n----\n${options.title}: ${options.value} ${options.unit ?? ''} ${options.legend ?? ''}\n----\n`;
|
|
35
|
-
}
|
|
36
35
|
}
|
|
37
36
|
export default ScoreCardMacro;
|
|
38
37
|
//# 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;IAEF,YAAY,GAAG,KAAK,EAAE,OAA+B,EAAE,KAAc,EAAE,EAAE;QACvE,OAAO,IAAI,CAAC,YAAY,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;IAC3C,CAAC,CAAC;IAEM,QAAQ,CAAC,KAAc;QAC7B,OAAO,oBAAoB,CAAmB,IAAI,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC;IACtE,CAAC;CACF;AAED,eAAe,cAAc,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
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
|
|
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/>.
|
|
13
|
+
*/
|
|
14
|
+
import type { MacroGenerationContext } from '../../interfaces/macros.js';
|
|
15
|
+
import BaseMacro from '../base-macro.js';
|
|
16
|
+
import type TaskQueue from '../task-queue.js';
|
|
17
|
+
import * as vega from 'vega';
|
|
18
|
+
export interface VegaMacroInput {
|
|
19
|
+
spec: vega.Spec;
|
|
20
|
+
}
|
|
21
|
+
declare class VegaMacro extends BaseMacro {
|
|
22
|
+
constructor(tasksQueue: TaskQueue);
|
|
23
|
+
handleValidate: (input: unknown) => void;
|
|
24
|
+
handleStatic: (_: MacroGenerationContext, input: unknown) => Promise<string>;
|
|
25
|
+
handleInject: (_: MacroGenerationContext, input: unknown) => Promise<string>;
|
|
26
|
+
private validate;
|
|
27
|
+
}
|
|
28
|
+
export default VegaMacro;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import BaseMacro from '../base-macro.js';
|
|
2
|
+
import macroMetadata from './metadata.js';
|
|
3
|
+
import { createHtmlPlaceholder, createImage, validateMacroContent, } from '../index.js';
|
|
4
|
+
import * as vega from 'vega';
|
|
5
|
+
class VegaMacro extends BaseMacro {
|
|
6
|
+
constructor(tasksQueue) {
|
|
7
|
+
super(macroMetadata, tasksQueue);
|
|
8
|
+
}
|
|
9
|
+
handleValidate = (input) => {
|
|
10
|
+
this.validate(input);
|
|
11
|
+
};
|
|
12
|
+
handleStatic = async (_, input) => {
|
|
13
|
+
const options = this.validate(input);
|
|
14
|
+
const view = new vega.View(vega.parse(options.spec), { renderer: 'none' });
|
|
15
|
+
const svg = await view.toSVG();
|
|
16
|
+
return createImage(Buffer.from(svg).toString('base64'), false);
|
|
17
|
+
};
|
|
18
|
+
handleInject = async (_, input) => {
|
|
19
|
+
const options = this.validate(input);
|
|
20
|
+
return createHtmlPlaceholder(this.metadata, options);
|
|
21
|
+
};
|
|
22
|
+
validate(input) {
|
|
23
|
+
return validateMacroContent(this.metadata, input);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
export default VegaMacro;
|
|
27
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/macros/vega/index.ts"],"names":[],"mappings":"AAcA,OAAO,SAAS,MAAM,kBAAkB,CAAC;AACzC,OAAO,aAAa,MAAM,eAAe,CAAC;AAE1C,OAAO,EACL,qBAAqB,EACrB,WAAW,EACX,oBAAoB,GACrB,MAAM,aAAa,CAAC;AACrB,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAM7B,MAAM,SAAU,SAAQ,SAAS;IAC/B,YAAY,UAAqB;QAC/B,KAAK,CAAC,aAAa,EAAE,UAAU,CAAC,CAAC;IACnC,CAAC;IAED,cAAc,GAAG,CAAC,KAAc,EAAE,EAAE;QAClC,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;IACvB,CAAC,CAAC;IAEF,YAAY,GAAG,KAAK,EAAE,CAAyB,EAAE,KAAc,EAAE,EAAE;QACjE,MAAM,OAAO,GAAG,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAmB,CAAC;QACvD,MAAM,IAAI,GAAG,IAAI,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,EAAE,QAAQ,EAAE,MAAM,EAAE,CAAC,CAAC;QAC3E,MAAM,GAAG,GAAG,MAAM,IAAI,CAAC,KAAK,EAAE,CAAC;QAC/B,OAAO,WAAW,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,EAAE,KAAK,CAAC,CAAC;IACjE,CAAC,CAAC;IAEF,YAAY,GAAG,KAAK,EAAE,CAAyB,EAAE,KAAc,EAAE,EAAE;QACjE,MAAM,OAAO,GAAG,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAmB,CAAC;QACvD,OAAO,qBAAqB,CAAC,IAAI,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;IACvD,CAAC,CAAC;IAEM,QAAQ,CAAC,KAAc;QAC7B,OAAO,oBAAoB,CAAiB,IAAI,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC;IACpE,CAAC;CACF;AAED,eAAe,SAAS,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.
|
|
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/>.
|
|
12
|
+
*/
|
|
13
|
+
import type { MacroMetadata } from '../../interfaces/macros.js';
|
|
14
|
+
declare const macroMetadata: MacroMetadata;
|
|
15
|
+
export default macroMetadata;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"metadata.js","sourceRoot":"","sources":["../../../src/macros/vega/metadata.ts"],"names":[],"mappings":"AAcA,MAAM,aAAa,GAAkB;IACnC,IAAI,EAAE,MAAM;IACZ,OAAO,EAAE,MAAM;IACf,MAAM,EAAE,iBAAiB;CAC1B,CAAC;AAEF,eAAe,aAAa,CAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
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.
|
|
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/>.
|
|
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
|
+
import * as vegaLite from 'vega-lite';
|
|
17
|
+
export interface VegaLiteMacroInput {
|
|
18
|
+
spec: vegaLite.TopLevelSpec;
|
|
19
|
+
}
|
|
20
|
+
declare class VegaLiteMacro extends BaseMacro {
|
|
21
|
+
constructor(tasksQueue: TaskQueue);
|
|
22
|
+
handleValidate: (input: unknown) => void;
|
|
23
|
+
handleStatic: (_: MacroGenerationContext, input: unknown) => Promise<string>;
|
|
24
|
+
handleInject: (context: MacroGenerationContext, input: unknown) => Promise<string>;
|
|
25
|
+
private validate;
|
|
26
|
+
}
|
|
27
|
+
export default VegaLiteMacro;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import BaseMacro from '../base-macro.js';
|
|
2
|
+
import macroMetadata from './metadata.js';
|
|
3
|
+
import * as vegaLite from 'vega-lite';
|
|
4
|
+
import { createMacro, validateMacroContent } from '../index.js';
|
|
5
|
+
class VegaLiteMacro extends BaseMacro {
|
|
6
|
+
constructor(tasksQueue) {
|
|
7
|
+
super(macroMetadata, tasksQueue);
|
|
8
|
+
}
|
|
9
|
+
handleValidate = (input) => {
|
|
10
|
+
this.validate(input);
|
|
11
|
+
};
|
|
12
|
+
handleStatic = async (_, input) => {
|
|
13
|
+
const options = this.validate(input);
|
|
14
|
+
const compiled = vegaLite.compile(options.spec).spec;
|
|
15
|
+
return createMacro('vega', {
|
|
16
|
+
spec: compiled,
|
|
17
|
+
});
|
|
18
|
+
};
|
|
19
|
+
handleInject = async (context, input) => {
|
|
20
|
+
return this.handleStatic(context, input);
|
|
21
|
+
};
|
|
22
|
+
validate(input) {
|
|
23
|
+
return validateMacroContent(this.metadata, input);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
export default VegaLiteMacro;
|
|
27
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/macros/vegalite/index.ts"],"names":[],"mappings":"AAaA,OAAO,SAAS,MAAM,kBAAkB,CAAC;AACzC,OAAO,aAAa,MAAM,eAAe,CAAC;AAE1C,OAAO,KAAK,QAAQ,MAAM,WAAW,CAAC;AACtC,OAAO,EAAE,WAAW,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAMhE,MAAM,aAAc,SAAQ,SAAS;IACnC,YAAY,UAAqB;QAC/B,KAAK,CAAC,aAAa,EAAE,UAAU,CAAC,CAAC;IACnC,CAAC;IAED,cAAc,GAAG,CAAC,KAAc,EAAE,EAAE;QAClC,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;IACvB,CAAC,CAAC;IAEF,YAAY,GAAG,KAAK,EAAE,CAAyB,EAAE,KAAc,EAAE,EAAE;QACjE,MAAM,OAAO,GAAG,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAuB,CAAC;QAC3D,MAAM,QAAQ,GAAG,QAAQ,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC;QACrD,OAAO,WAAW,CAAC,MAAM,EAAE;YACzB,IAAI,EAAE,QAAQ;SACf,CAAC,CAAC;IACL,CAAC,CAAC;IAEF,YAAY,GAAG,KAAK,EAAE,OAA+B,EAAE,KAAc,EAAE,EAAE;QACvE,OAAO,IAAI,CAAC,YAAY,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;IAC3C,CAAC,CAAC;IAEM,QAAQ,CAAC,KAAc;QAC7B,OAAO,oBAAoB,CAAqB,IAAI,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC;IACxE,CAAC;CACF;AAED,eAAe,aAAa,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.
|
|
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/>.
|
|
12
|
+
*/
|
|
13
|
+
import type { MacroMetadata } from '../../interfaces/macros.js';
|
|
14
|
+
declare const macroMetadata: MacroMetadata;
|
|
15
|
+
export default macroMetadata;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"metadata.js","sourceRoot":"","sources":["../../../src/macros/vegalite/metadata.ts"],"names":[],"mappings":"AAcA,MAAM,aAAa,GAAkB;IACnC,IAAI,EAAE,UAAU;IAChB,OAAO,EAAE,UAAU;IACnB,MAAM,EAAE,qBAAqB;CAC9B,CAAC;AAEF,eAAe,aAAa,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
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.
|
|
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/>.
|
|
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 XrefMacroOptions {
|
|
17
|
+
cardKey: string;
|
|
18
|
+
}
|
|
19
|
+
export default class XrefMacro extends BaseMacro {
|
|
20
|
+
constructor(tasksQueue: TaskQueue);
|
|
21
|
+
handleValidate: (input: unknown) => void;
|
|
22
|
+
handleStatic: (context: MacroGenerationContext, input: unknown) => Promise<string>;
|
|
23
|
+
handleInject: (context: MacroGenerationContext, input: unknown) => Promise<string>;
|
|
24
|
+
private getCard;
|
|
25
|
+
private validate;
|
|
26
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
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.
|
|
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/>.
|
|
12
|
+
*/
|
|
13
|
+
import { validateMacroContent } from '../index.js';
|
|
14
|
+
import macroMetadata from './metadata.js';
|
|
15
|
+
import BaseMacro from '../base-macro.js';
|
|
16
|
+
export default class XrefMacro extends BaseMacro {
|
|
17
|
+
constructor(tasksQueue) {
|
|
18
|
+
super(macroMetadata, tasksQueue);
|
|
19
|
+
}
|
|
20
|
+
handleValidate = (input) => {
|
|
21
|
+
this.validate(input);
|
|
22
|
+
};
|
|
23
|
+
handleStatic = async (context, input) => {
|
|
24
|
+
const options = this.validate(input);
|
|
25
|
+
const card = await this.getCard(options.cardKey, context);
|
|
26
|
+
if (!card || !card.metadata) {
|
|
27
|
+
throw new Error(`Card key ${options.cardKey} not found`);
|
|
28
|
+
}
|
|
29
|
+
// in static mode we need to use internal references
|
|
30
|
+
return `<<${options.cardKey}>>`;
|
|
31
|
+
};
|
|
32
|
+
handleInject = async (context, input) => {
|
|
33
|
+
const options = this.validate(input);
|
|
34
|
+
const card = await this.getCard(options.cardKey, context);
|
|
35
|
+
if (!card || !card.metadata) {
|
|
36
|
+
throw new Error(`Card key ${options.cardKey} not found`);
|
|
37
|
+
}
|
|
38
|
+
return `xref:${options.cardKey}.adoc[${card.metadata.title}]`;
|
|
39
|
+
};
|
|
40
|
+
async getCard(cardKey, context) {
|
|
41
|
+
const card = await context.project.cardDetailsById(cardKey, {
|
|
42
|
+
metadata: true,
|
|
43
|
+
});
|
|
44
|
+
if (!card || !card.metadata) {
|
|
45
|
+
throw new Error(`Card key ${cardKey} not found`);
|
|
46
|
+
}
|
|
47
|
+
return card;
|
|
48
|
+
}
|
|
49
|
+
validate(input) {
|
|
50
|
+
return validateMacroContent(this.metadata, input);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/macros/xref/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;AAOzC,MAAM,CAAC,OAAO,OAAO,SAAU,SAAQ,SAAS;IAC9C,YAAY,UAAqB;QAC/B,KAAK,CAAC,aAAa,EAAE,UAAU,CAA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