@cyberismo/data-handler 0.0.13 → 0.0.15
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/card-metadata-updater.js +1 -3
- package/dist/card-metadata-updater.js.map +1 -1
- package/dist/command-handler.js +13 -17
- package/dist/command-handler.js.map +1 -1
- package/dist/command-manager.d.ts +1 -1
- package/dist/command-manager.js +4 -3
- package/dist/command-manager.js.map +1 -1
- package/dist/commands/create.d.ts +3 -3
- package/dist/commands/create.js +20 -81
- package/dist/commands/create.js.map +1 -1
- package/dist/commands/edit.d.ts +12 -25
- package/dist/commands/edit.js +25 -74
- package/dist/commands/edit.js.map +1 -1
- package/dist/commands/export.js +4 -17
- package/dist/commands/export.js.map +1 -1
- package/dist/commands/fetch.js +2 -1
- package/dist/commands/fetch.js.map +1 -1
- package/dist/commands/import.js +3 -5
- package/dist/commands/import.js.map +1 -1
- package/dist/commands/move.d.ts +1 -2
- package/dist/commands/move.js +108 -146
- package/dist/commands/move.js.map +1 -1
- package/dist/commands/remove.js +15 -49
- package/dist/commands/remove.js.map +1 -1
- package/dist/commands/rename.d.ts +1 -0
- package/dist/commands/rename.js +13 -7
- package/dist/commands/rename.js.map +1 -1
- package/dist/commands/show.d.ts +7 -25
- package/dist/commands/show.js +39 -113
- package/dist/commands/show.js.map +1 -1
- package/dist/commands/transition.js +27 -30
- package/dist/commands/transition.js.map +1 -1
- package/dist/commands/update.d.ts +5 -3
- package/dist/commands/update.js +19 -5
- package/dist/commands/update.js.map +1 -1
- package/dist/commands/validate.d.ts +3 -3
- package/dist/commands/validate.js +20 -27
- package/dist/commands/validate.js.map +1 -1
- package/dist/containers/card-container.d.ts +87 -24
- package/dist/containers/card-container.js +183 -279
- package/dist/containers/card-container.js.map +1 -1
- package/dist/containers/project/calculation-engine.d.ts +6 -0
- package/dist/containers/project/calculation-engine.js +36 -29
- package/dist/containers/project/calculation-engine.js.map +1 -1
- package/dist/containers/project/card-cache.d.ts +146 -0
- package/dist/containers/project/card-cache.js +411 -0
- package/dist/containers/project/card-cache.js.map +1 -0
- package/dist/containers/project/resource-collector.d.ts +24 -1
- package/dist/containers/project/resource-collector.js +8 -1
- package/dist/containers/project/resource-collector.js.map +1 -1
- package/dist/containers/project.d.ts +119 -84
- package/dist/containers/project.js +423 -253
- package/dist/containers/project.js.map +1 -1
- package/dist/containers/template.d.ts +15 -31
- package/dist/containers/template.js +97 -104
- package/dist/containers/template.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/interfaces/folder-content-interfaces.d.ts +12 -5
- package/dist/interfaces/folder-content-interfaces.js +5 -3
- package/dist/interfaces/folder-content-interfaces.js.map +1 -1
- package/dist/interfaces/macros.d.ts +1 -0
- package/dist/interfaces/macros.js +1 -1
- package/dist/interfaces/macros.js.map +1 -1
- package/dist/interfaces/project-interfaces.d.ts +16 -10
- package/dist/interfaces/project-interfaces.js +10 -8
- package/dist/interfaces/project-interfaces.js.map +1 -1
- package/dist/interfaces/resource-interfaces.d.ts +21 -22
- package/dist/interfaces/resource-interfaces.js +3 -0
- package/dist/interfaces/resource-interfaces.js.map +1 -1
- package/dist/macros/common.d.ts +10 -10
- package/dist/macros/createCards/index.d.ts +0 -13
- package/dist/macros/createCards/index.js.map +1 -1
- package/dist/macros/createCards/types.d.ts +44 -0
- package/dist/macros/createCards/types.js +15 -0
- package/dist/macros/createCards/types.js.map +1 -0
- package/dist/macros/graph/index.d.ts +2 -6
- package/dist/macros/graph/index.js +2 -2
- package/dist/macros/graph/index.js.map +1 -1
- package/dist/macros/graph/types.d.ts +23 -0
- package/dist/macros/graph/types.js +15 -0
- package/dist/macros/graph/types.js.map +1 -0
- package/dist/macros/image/index.d.ts +8 -16
- package/dist/macros/image/index.js +36 -33
- package/dist/macros/image/index.js.map +1 -1
- package/dist/macros/image/types.d.ts +38 -0
- package/dist/macros/image/types.js +15 -0
- package/dist/macros/image/types.js.map +1 -0
- package/dist/macros/include/index.d.ts +1 -6
- package/dist/macros/include/index.js +4 -7
- package/dist/macros/include/index.js.map +1 -1
- package/dist/macros/include/types.d.ts +31 -0
- package/dist/macros/include/types.js +15 -0
- package/dist/macros/include/types.js.map +1 -0
- package/dist/macros/percentage/index.d.ts +0 -6
- package/dist/macros/percentage/index.js.map +1 -1
- package/dist/macros/percentage/types.d.ts +31 -0
- package/dist/macros/percentage/types.js +15 -0
- package/dist/macros/percentage/types.js.map +1 -0
- package/dist/macros/report/index.d.ts +0 -3
- package/dist/macros/report/index.js.map +1 -1
- package/dist/macros/report/types.d.ts +19 -0
- package/dist/macros/report/types.js +15 -0
- package/dist/macros/report/types.js.map +1 -0
- package/dist/macros/scoreCard/index.d.ts +0 -6
- package/dist/macros/scoreCard/index.js.map +1 -1
- package/dist/macros/scoreCard/types.d.ts +31 -0
- package/dist/macros/scoreCard/types.js +15 -0
- package/dist/macros/scoreCard/types.js.map +1 -0
- package/dist/macros/types.d.ts +25 -0
- package/dist/macros/types.js +2 -0
- package/dist/macros/types.js.map +1 -0
- package/dist/macros/vega/index.d.ts +0 -4
- package/dist/macros/vega/index.js.map +1 -1
- package/dist/macros/vega/types.d.ts +20 -0
- package/dist/macros/vega/types.js +2 -0
- package/dist/macros/vega/types.js.map +1 -0
- package/dist/macros/vegalite/index.d.ts +0 -4
- package/dist/macros/vegalite/index.js.map +1 -1
- package/dist/macros/vegalite/types.d.ts +20 -0
- package/dist/macros/vegalite/types.js +15 -0
- package/dist/macros/vegalite/types.js.map +1 -0
- package/dist/macros/xref/index.d.ts +0 -3
- package/dist/macros/xref/index.js +5 -14
- package/dist/macros/xref/index.js.map +1 -1
- package/dist/macros/xref/types.d.ts +19 -0
- package/dist/macros/xref/types.js +15 -0
- package/dist/macros/xref/types.js.map +1 -0
- package/dist/module-manager.js +4 -4
- package/dist/module-manager.js.map +1 -1
- package/dist/project-settings.js.map +1 -1
- package/dist/resources/calculation-resource.d.ts +43 -0
- package/dist/resources/calculation-resource.js +75 -0
- package/dist/resources/calculation-resource.js.map +1 -0
- package/dist/resources/card-type-resource.d.ts +4 -21
- package/dist/resources/card-type-resource.js +13 -44
- package/dist/resources/card-type-resource.js.map +1 -1
- package/dist/resources/create-defaults.d.ts +13 -6
- package/dist/resources/create-defaults.js +19 -5
- package/dist/resources/create-defaults.js.map +1 -1
- package/dist/resources/field-type-resource.d.ts +4 -21
- package/dist/resources/field-type-resource.js +14 -38
- package/dist/resources/field-type-resource.js.map +1 -1
- package/dist/resources/file-resource.d.ts +12 -29
- package/dist/resources/file-resource.js +19 -287
- package/dist/resources/file-resource.js.map +1 -1
- package/dist/resources/folder-resource.d.ts +32 -51
- package/dist/resources/folder-resource.js +68 -96
- package/dist/resources/folder-resource.js.map +1 -1
- package/dist/resources/graph-model-resource.d.ts +5 -33
- package/dist/resources/graph-model-resource.js +8 -61
- package/dist/resources/graph-model-resource.js.map +1 -1
- package/dist/resources/graph-view-resource.d.ts +5 -28
- package/dist/resources/graph-view-resource.js +6 -45
- package/dist/resources/graph-view-resource.js.map +1 -1
- package/dist/resources/link-type-resource.d.ts +4 -21
- package/dist/resources/link-type-resource.js +6 -31
- package/dist/resources/link-type-resource.js.map +1 -1
- package/dist/resources/report-resource.d.ts +5 -17
- package/dist/resources/report-resource.js +6 -44
- package/dist/resources/report-resource.js.map +1 -1
- package/dist/resources/resource-object.d.ts +58 -23
- package/dist/resources/resource-object.js +307 -26
- package/dist/resources/resource-object.js.map +1 -1
- package/dist/resources/template-resource.d.ts +4 -15
- package/dist/resources/template-resource.js +10 -25
- package/dist/resources/template-resource.js.map +1 -1
- package/dist/resources/workflow-resource.d.ts +4 -23
- package/dist/resources/workflow-resource.js +12 -38
- package/dist/resources/workflow-resource.js.map +1 -1
- package/dist/utils/card-utils.d.ts +69 -19
- package/dist/utils/card-utils.js +179 -30
- package/dist/utils/card-utils.js.map +1 -1
- package/dist/utils/clingo-facts.js +11 -3
- package/dist/utils/clingo-facts.js.map +1 -1
- package/dist/utils/clingo-parser.js +1 -1
- package/dist/utils/clingo-parser.js.map +1 -1
- package/dist/utils/constants.d.ts +2 -0
- package/dist/utils/constants.js +5 -0
- package/dist/utils/constants.js.map +1 -1
- package/dist/utils/csv.js +1 -1
- package/dist/utils/csv.js.map +1 -1
- package/dist/utils/error-utils.d.ts +34 -0
- package/dist/utils/error-utils.js +56 -0
- package/dist/utils/error-utils.js.map +1 -0
- package/dist/utils/log-utils.d.ts +0 -27
- package/dist/utils/log-utils.js +0 -58
- package/dist/utils/log-utils.js.map +1 -1
- package/dist/utils/user-preferences.js +6 -3
- package/dist/utils/user-preferences.js.map +1 -1
- package/package.json +5 -5
- package/src/card-metadata-updater.ts +3 -5
- package/src/command-handler.ts +14 -19
- package/src/command-manager.ts +4 -3
- package/src/commands/create.ts +28 -112
- package/src/commands/edit.ts +27 -118
- package/src/commands/export.ts +8 -29
- package/src/commands/fetch.ts +2 -1
- package/src/commands/import.ts +4 -6
- package/src/commands/move.ts +144 -179
- package/src/commands/remove.ts +12 -54
- package/src/commands/rename.ts +22 -7
- package/src/commands/show.ts +51 -156
- package/src/commands/transition.ts +30 -33
- package/src/commands/update.ts +27 -9
- package/src/commands/validate.ts +22 -37
- package/src/containers/card-container.ts +200 -360
- package/src/containers/project/calculation-engine.ts +43 -33
- package/src/containers/project/card-cache.ts +497 -0
- package/src/containers/project/resource-collector.ts +9 -1
- package/src/containers/project.ts +533 -328
- package/src/containers/template.ts +109 -127
- package/src/index.ts +1 -0
- package/src/interfaces/folder-content-interfaces.ts +23 -5
- package/src/interfaces/macros.ts +2 -0
- package/src/interfaces/project-interfaces.ts +19 -10
- package/src/interfaces/resource-interfaces.ts +22 -24
- package/src/macros/createCards/index.ts +1 -12
- package/src/macros/createCards/types.ts +46 -0
- package/src/macros/graph/index.ts +3 -7
- package/src/macros/graph/types.ts +24 -0
- package/src/macros/image/index.ts +50 -61
- package/src/macros/image/types.ts +39 -0
- package/src/macros/include/index.ts +6 -15
- package/src/macros/include/types.ts +32 -0
- package/src/macros/percentage/index.ts +1 -7
- package/src/macros/percentage/types.ts +32 -0
- package/src/macros/report/index.ts +1 -4
- package/src/macros/report/types.ts +20 -0
- package/src/macros/scoreCard/index.ts +1 -7
- package/src/macros/scoreCard/types.ts +32 -0
- package/src/macros/types.ts +48 -0
- package/src/macros/vega/index.ts +1 -4
- package/src/macros/vega/types.ts +21 -0
- package/src/macros/vegalite/index.ts +1 -4
- package/src/macros/vegalite/types.ts +22 -0
- package/src/macros/xref/index.ts +6 -20
- package/src/macros/xref/types.ts +20 -0
- package/src/module-manager.ts +5 -5
- package/src/project-settings.ts +1 -1
- package/src/resources/calculation-resource.ts +101 -0
- package/src/resources/card-type-resource.ts +24 -59
- package/src/resources/create-defaults.ts +21 -5
- package/src/resources/field-type-resource.ts +22 -51
- package/src/resources/file-resource.ts +27 -403
- package/src/resources/folder-resource.ts +99 -125
- package/src/resources/graph-model-resource.ts +17 -74
- package/src/resources/graph-view-resource.ts +14 -54
- package/src/resources/link-type-resource.ts +13 -40
- package/src/resources/report-resource.ts +17 -57
- package/src/resources/resource-object.ts +454 -39
- package/src/resources/template-resource.ts +16 -29
- package/src/resources/workflow-resource.ts +26 -50
- package/src/utils/card-utils.ts +217 -31
- package/src/utils/clingo-facts.ts +13 -3
- package/src/utils/clingo-parser.ts +1 -1
- package/src/utils/constants.ts +7 -0
- package/src/utils/csv.ts +1 -1
- package/src/utils/error-utils.ts +62 -0
- package/src/utils/log-utils.ts +0 -68
- package/src/utils/user-preferences.ts +7 -3
|
@@ -10,30 +10,22 @@
|
|
|
10
10
|
details. 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 { MacroGenerationContext } from '../../interfaces/macros.js';
|
|
14
13
|
import BaseMacro from '../base-macro.js';
|
|
14
|
+
import type { MacroGenerationContext } from '../../interfaces/macros.js';
|
|
15
15
|
import type TaskQueue from '../task-queue.js';
|
|
16
|
-
/**
|
|
17
|
-
* Options for the image macro.
|
|
18
|
-
* @param fileName - Name of the file to include.
|
|
19
|
-
* @param cardKey - Key of the card to include the file from.
|
|
20
|
-
* @param alt - Alternative text for the image.
|
|
21
|
-
* @param title - Title of the image.
|
|
22
|
-
*/
|
|
23
|
-
export interface ImageMacroOptions {
|
|
24
|
-
fileName: string;
|
|
25
|
-
cardKey?: string;
|
|
26
|
-
alt?: string;
|
|
27
|
-
title?: string;
|
|
28
|
-
}
|
|
29
16
|
/**
|
|
30
17
|
* Macro for including images in the content
|
|
31
18
|
*/
|
|
32
19
|
export default class ImageMacro extends BaseMacro {
|
|
20
|
+
/**
|
|
21
|
+
* Constructs ImageMacro instance.
|
|
22
|
+
* @param tasksQueue Tasks queue
|
|
23
|
+
*/
|
|
33
24
|
constructor(tasksQueue: TaskQueue);
|
|
25
|
+
private attachment;
|
|
26
|
+
private buildImageAttributes;
|
|
27
|
+
private validate;
|
|
34
28
|
handleValidate: (_: MacroGenerationContext, input: unknown) => void;
|
|
35
29
|
handleStatic: (context: MacroGenerationContext, input: unknown) => Promise<string>;
|
|
36
30
|
handleInject: (context: MacroGenerationContext, input: unknown) => Promise<string>;
|
|
37
|
-
private buildImageAttributes;
|
|
38
|
-
private validate;
|
|
39
31
|
}
|
|
@@ -10,67 +10,70 @@
|
|
|
10
10
|
details. 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 {
|
|
13
|
+
import { readFileSync } from 'node:fs';
|
|
14
14
|
import { join } from 'node:path';
|
|
15
|
-
import mime from 'mime-types';
|
|
16
|
-
import { validateMacroContent } from '../index.js';
|
|
17
|
-
import macroMetadata from './metadata.js';
|
|
18
15
|
import BaseMacro from '../base-macro.js';
|
|
16
|
+
import macroMetadata from './metadata.js';
|
|
17
|
+
import { validateMacroContent } from '../index.js';
|
|
19
18
|
/**
|
|
20
19
|
* Macro for including images in the content
|
|
21
20
|
*/
|
|
22
21
|
export default class ImageMacro extends BaseMacro {
|
|
22
|
+
/**
|
|
23
|
+
* Constructs ImageMacro instance.
|
|
24
|
+
* @param tasksQueue Tasks queue
|
|
25
|
+
*/
|
|
23
26
|
constructor(tasksQueue) {
|
|
24
27
|
super(macroMetadata, tasksQueue);
|
|
25
28
|
}
|
|
29
|
+
// Gets card attachment.
|
|
30
|
+
attachment(context, cardKey, filename) {
|
|
31
|
+
const card = context.project.findCard(cardKey);
|
|
32
|
+
const attachment = card.attachments?.find((a) => a.fileName === filename) ?? undefined;
|
|
33
|
+
if (!attachment) {
|
|
34
|
+
throw new Error(`Attachment file '${filename}' not found in card '${cardKey}'`);
|
|
35
|
+
}
|
|
36
|
+
return attachment;
|
|
37
|
+
}
|
|
38
|
+
buildImageAttributes(options) {
|
|
39
|
+
const attributes = [];
|
|
40
|
+
if (options.alt !== undefined) {
|
|
41
|
+
attributes.push(`alt="${options.alt}"`);
|
|
42
|
+
}
|
|
43
|
+
if (options.title !== undefined) {
|
|
44
|
+
attributes.push(`title="${options.title}"`);
|
|
45
|
+
}
|
|
46
|
+
return attributes.join(',');
|
|
47
|
+
}
|
|
48
|
+
validate(input) {
|
|
49
|
+
return validateMacroContent(this.metadata, input);
|
|
50
|
+
}
|
|
26
51
|
handleValidate = (_, input) => {
|
|
27
52
|
this.validate(input);
|
|
28
53
|
};
|
|
29
54
|
handleStatic = async (context, input) => {
|
|
30
55
|
const options = this.validate(input);
|
|
31
56
|
const cardKey = options.cardKey || context.cardKey;
|
|
32
|
-
// Get the attachment
|
|
33
|
-
const
|
|
34
|
-
//
|
|
35
|
-
const attachmentPath = join(
|
|
36
|
-
if (!existsSync(attachmentPath)) {
|
|
37
|
-
throw new Error(`Attachment file '${options.fileName}' not found in card '${cardKey}'`);
|
|
38
|
-
}
|
|
57
|
+
// Get the attachment
|
|
58
|
+
const cardAttachment = this.attachment(context, cardKey, options.fileName);
|
|
59
|
+
// Convert to base64
|
|
60
|
+
const attachmentPath = join(cardAttachment?.path, cardAttachment?.fileName);
|
|
39
61
|
const fileBuffer = readFileSync(attachmentPath);
|
|
40
62
|
const base64Data = fileBuffer.toString('base64');
|
|
41
|
-
// Get mime type
|
|
42
|
-
const mimeType = mime.lookup(attachmentPath) || 'application/octet-stream';
|
|
43
63
|
// Build image attributes
|
|
44
64
|
const attributes = this.buildImageAttributes(options);
|
|
45
65
|
// Return as data URI for static mode (for export/PDF generation)
|
|
46
|
-
return `image::data:${mimeType};base64,${base64Data}[${attributes}]`;
|
|
66
|
+
return `image::data:${cardAttachment.mimeType};base64,${base64Data}[${attributes}]`;
|
|
47
67
|
};
|
|
48
68
|
handleInject = async (context, input) => {
|
|
49
69
|
const options = this.validate(input);
|
|
50
70
|
const cardKey = options.cardKey || context.cardKey;
|
|
51
|
-
//
|
|
52
|
-
|
|
53
|
-
const attachmentPath = join(attachmentFolder, options.fileName);
|
|
54
|
-
if (!existsSync(attachmentPath)) {
|
|
55
|
-
throw new Error(`Attachment file '${options.fileName}' not found in card '${cardKey}'`);
|
|
56
|
-
}
|
|
71
|
+
// Just verify that the attachment exists.
|
|
72
|
+
this.attachment(context, cardKey, options.fileName);
|
|
57
73
|
// Build image attributes
|
|
58
74
|
const attributes = this.buildImageAttributes(options);
|
|
59
75
|
// In inject mode, always use the API path for consistency
|
|
60
76
|
return `image::/api/cards/${cardKey}/a/${options.fileName}[${attributes}]`;
|
|
61
77
|
};
|
|
62
|
-
buildImageAttributes(options) {
|
|
63
|
-
const attributes = [];
|
|
64
|
-
if (options.alt !== undefined) {
|
|
65
|
-
attributes.push(`alt="${options.alt}"`);
|
|
66
|
-
}
|
|
67
|
-
if (options.title !== undefined) {
|
|
68
|
-
attributes.push(`title="${options.title}"`);
|
|
69
|
-
}
|
|
70
|
-
return attributes.join(',');
|
|
71
|
-
}
|
|
72
|
-
validate(input) {
|
|
73
|
-
return validateMacroContent(this.metadata, input);
|
|
74
|
-
}
|
|
75
78
|
}
|
|
76
79
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/macros/image/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;EAWE;AAEF,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/macros/image/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;EAWE;AAEF,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,OAAO,SAAS,MAAM,kBAAkB,CAAC;AACzC,OAAO,aAAa,MAAM,eAAe,CAAC;AAC1C,OAAO,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAMnD;;GAEG;AACH,MAAM,CAAC,OAAO,OAAO,UAAW,SAAQ,SAAS;IAC/C;;;OAGG;IACH,YAAY,UAAqB;QAC/B,KAAK,CAAC,aAAa,EAAE,UAAU,CAAC,CAAC;IACnC,CAAC;IAED,wBAAwB;IAChB,UAAU,CAChB,OAA+B,EAC/B,OAAe,EACf,QAAgB;QAEhB,MAAM,IAAI,GAAG,OAAO,CAAC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;QAC/C,MAAM,UAAU,GACd,IAAI,CAAC,WAAW,EAAE,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,KAAK,QAAQ,CAAC,IAAI,SAAS,CAAC;QACtE,IAAI,CAAC,UAAU,EAAE,CAAC;YAChB,MAAM,IAAI,KAAK,CACb,oBAAoB,QAAQ,wBAAwB,OAAO,GAAG,CAC/D,CAAC;QACJ,CAAC;QACD,OAAO,UAAU,CAAC;IACpB,CAAC;IAEO,oBAAoB,CAAC,OAA0B;QACrD,MAAM,UAAU,GAAa,EAAE,CAAC;QAEhC,IAAI,OAAO,CAAC,GAAG,KAAK,SAAS,EAAE,CAAC;YAC9B,UAAU,CAAC,IAAI,CAAC,QAAQ,OA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YAAY,GAAG,KAAK,EAAE,OAA+B,EAAE,KAAc,EAAE,EAAE;QACvE,MAAM,OAAO,GAAG,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;QACrC,MAAM,OAAO,GAAG,OAAO,CAAC,OAAO,IAAI,OAAO,CAAC,OAAO,CAAC;QAEnD,0CAA0C;QAC1C,IAAI,CAAC,UAAU,CAAC,OAAO,EAAE,OAAO,EAAE,OAAO,CAAC,QAAQ,CAAC,CAAC;QAEpD,yBAAyB;QACzB,MAAM,UAAU,GAAG,IAAI,CAAC,oBAAoB,CAAC,OAAO,CAAC,CAAC;QAEtD,0DAA0D;QAC1D,OAAO,qBAAqB,OAAO,MAAM,OAAO,CAAC,QAAQ,IAAI,UAAU,GAAG,CAAC;IAC7E,CAAC,CAAC;CACH"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
Cyberismo
|
|
3
|
+
Copyright © Cyberismo Ltd and contributors 2025
|
|
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
|
+
/**
|
|
15
|
+
* Options for the image macro.
|
|
16
|
+
* @param fileName - Name of the file to include.
|
|
17
|
+
* @param cardKey - Key of the card to include the file from.
|
|
18
|
+
* @param alt - Alternative text for the image.
|
|
19
|
+
* @param title - Title of the image.
|
|
20
|
+
*/
|
|
21
|
+
export interface ImageMacroOptions {
|
|
22
|
+
/**
|
|
23
|
+
* Filename of the image
|
|
24
|
+
*/
|
|
25
|
+
fileName: string;
|
|
26
|
+
/**
|
|
27
|
+
* By default, image is assumed to be under the current card. You can override this behaviour
|
|
28
|
+
*/
|
|
29
|
+
cardKey?: string;
|
|
30
|
+
/**
|
|
31
|
+
* Alt text
|
|
32
|
+
*/
|
|
33
|
+
alt?: string;
|
|
34
|
+
/**
|
|
35
|
+
* Title for the image
|
|
36
|
+
*/
|
|
37
|
+
title?: string;
|
|
38
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
Cyberismo
|
|
3
|
+
Copyright © Cyberismo Ltd and contributors 2025
|
|
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
|
+
export {};
|
|
15
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/macros/image/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;EAYE"}
|
|
@@ -13,12 +13,6 @@
|
|
|
13
13
|
import type { MacroGenerationContext } from '../../interfaces/macros.js';
|
|
14
14
|
import BaseMacro from '../base-macro.js';
|
|
15
15
|
import type TaskQueue from '../task-queue.js';
|
|
16
|
-
export interface IncludeMacroOptions {
|
|
17
|
-
cardKey: string;
|
|
18
|
-
levelOffset?: string;
|
|
19
|
-
title?: 'include' | 'exclude' | 'only';
|
|
20
|
-
pageTitles?: 'normal' | 'discrete';
|
|
21
|
-
}
|
|
22
16
|
export default class IncludeMacro extends BaseMacro {
|
|
23
17
|
constructor(tasksQueue: TaskQueue);
|
|
24
18
|
handleValidate: (_: MacroGenerationContext, input: unknown) => void;
|
|
@@ -27,5 +21,6 @@ export default class IncludeMacro extends BaseMacro {
|
|
|
27
21
|
private generateAnchor;
|
|
28
22
|
private generateTitle;
|
|
29
23
|
private generateCardContent;
|
|
24
|
+
private getCard;
|
|
30
25
|
private adjustTitles;
|
|
31
26
|
}
|
|
@@ -29,17 +29,11 @@ export default class IncludeMacro extends BaseMacro {
|
|
|
29
29
|
if (!options.pageTitles) {
|
|
30
30
|
options.pageTitles = 'normal';
|
|
31
31
|
}
|
|
32
|
-
const card = await context.project.cardDetailsById(options.cardKey, {
|
|
33
|
-
content: true,
|
|
34
|
-
metadata: true,
|
|
35
|
-
});
|
|
36
|
-
if (!card) {
|
|
37
|
-
throw new Error(`Card key ${options.cardKey} not found`);
|
|
38
|
-
}
|
|
39
32
|
const newContext = {
|
|
40
33
|
...context,
|
|
41
34
|
cardKey: options.cardKey,
|
|
42
35
|
};
|
|
36
|
+
const card = this.getCard(options.cardKey, context);
|
|
43
37
|
const anchor = this.generateAnchor(options);
|
|
44
38
|
const title = this.generateTitle(options, card.metadata?.title);
|
|
45
39
|
const cardContent = await this.generateCardContent(options, card.content, newContext);
|
|
@@ -75,6 +69,9 @@ export default class IncludeMacro extends BaseMacro {
|
|
|
75
69
|
}
|
|
76
70
|
return '';
|
|
77
71
|
}
|
|
72
|
+
getCard(cardKey, context) {
|
|
73
|
+
return context.project.findCard(cardKey);
|
|
74
|
+
}
|
|
78
75
|
// Adjust asciidoc titles to match the level offset
|
|
79
76
|
adjustTitles(content, levelOffset, discrete) {
|
|
80
77
|
const lines = content.split('\n');
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/macros/include/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;EAWE;AAEF,OAAO,EAAE,cAAc,EAAE,oBAAoB,EAAE,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;QACd,CAAC,CAAC,CAAC;QACH,OAAO,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAClC,CAAC;CACF"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
Cyberismo
|
|
3
|
+
Copyright © Cyberismo Ltd and contributors 2025
|
|
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
|
+
export interface IncludeMacroOptions {
|
|
15
|
+
/**
|
|
16
|
+
* Card key of the card being included
|
|
17
|
+
*/
|
|
18
|
+
cardKey: string;
|
|
19
|
+
/**
|
|
20
|
+
* A positive number wil increase the level of headings and a negative alue will the level of headings in the included content
|
|
21
|
+
*/
|
|
22
|
+
levelOffset?: string;
|
|
23
|
+
/**
|
|
24
|
+
* Determines behaviour with the title that is in card metadata
|
|
25
|
+
* include --> includes the title
|
|
26
|
+
* exclude --> excludes the title
|
|
27
|
+
* only --> includes title but does not import content
|
|
28
|
+
*/
|
|
29
|
+
title?: 'include' | 'exclude' | 'only';
|
|
30
|
+
pageTitles?: 'normal' | 'discrete';
|
|
31
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
Cyberismo
|
|
3
|
+
Copyright © Cyberismo Ltd and contributors 2025
|
|
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
|
+
export {};
|
|
15
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/macros/include/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;EAYE"}
|
|
@@ -13,12 +13,6 @@
|
|
|
13
13
|
import type { MacroGenerationContext } from '../../interfaces/macros.js';
|
|
14
14
|
import BaseMacro from '../base-macro.js';
|
|
15
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
16
|
declare class PercentageMacro extends BaseMacro {
|
|
23
17
|
constructor(tasksQueue: TaskQueue);
|
|
24
18
|
handleValidate: (_: MacroGenerationContext, data: string) => void;
|
|
@@ -1 +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;
|
|
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;AAE1C,OAAO,SAAS,MAAM,kBAAkB,CAAC;AAEzC,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAEhD,MAAM,eAAgB,SAAQ,SAAS;IACrC,YAAY,UAAqB;QAC/B,KAAK,CAAC,aAAa,EAAE,UAAU,CAAC,CAAC;IACnC,CAAC;IACD,cAAc,GAAG,CAAC,CAAyB,EAAE,IAAY,EAAE,EAAE;QAC3D,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,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
Cyberismo
|
|
3
|
+
Copyright © Cyberismo Ltd and contributors 2025
|
|
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
|
+
export interface PercentageOptions {
|
|
15
|
+
/**
|
|
16
|
+
* Title of percentage macro
|
|
17
|
+
*/
|
|
18
|
+
title: string;
|
|
19
|
+
/**
|
|
20
|
+
* Percentage value
|
|
21
|
+
*/
|
|
22
|
+
value: number;
|
|
23
|
+
/**
|
|
24
|
+
* Legend text below the macro
|
|
25
|
+
*/
|
|
26
|
+
legend: string;
|
|
27
|
+
/**
|
|
28
|
+
* Color of the bar the represents the percentage
|
|
29
|
+
*/
|
|
30
|
+
colour?: 'blue' | 'green' | 'yellow' | 'red' | 'orange' | 'purple';
|
|
31
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
Cyberismo
|
|
3
|
+
Copyright © Cyberismo Ltd and contributors 2025
|
|
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
|
+
export {};
|
|
15
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/macros/percentage/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;EAYE"}
|
|
@@ -13,9 +13,6 @@
|
|
|
13
13
|
import type { MacroGenerationContext } from '../../interfaces/macros.js';
|
|
14
14
|
import BaseMacro from '../base-macro.js';
|
|
15
15
|
import type TaskQueue from '../task-queue.js';
|
|
16
|
-
export interface ReportOptions {
|
|
17
|
-
name: string;
|
|
18
|
-
}
|
|
19
16
|
declare class ReportMacro extends BaseMacro {
|
|
20
17
|
constructor(tasks: TaskQueue);
|
|
21
18
|
handleValidate: (_: MacroGenerationContext, input: unknown) => void;
|
|
@@ -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;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;
|
|
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;AAGrD,MAAM,WAAY,SAAQ,SAAS;IACjC,YAAY,KAAgB;QAC1B,KAAK,CAAC,aAAa,EAAE,KAAK,CAAC,CAAC;IAC9B,CAAC;IACD,cAAc,GAA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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"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
Cyberismo
|
|
3
|
+
Copyright © Cyberismo Ltd and contributors 2025
|
|
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
|
+
export interface ReportOptions {
|
|
15
|
+
/**
|
|
16
|
+
* Name of the report
|
|
17
|
+
*/
|
|
18
|
+
name: string;
|
|
19
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
Cyberismo
|
|
3
|
+
Copyright © Cyberismo Ltd and contributors 2025
|
|
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
|
+
export {};
|
|
15
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/macros/report/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;EAYE"}
|
|
@@ -14,12 +14,6 @@
|
|
|
14
14
|
import type { MacroGenerationContext } from '../../interfaces/macros.js';
|
|
15
15
|
import BaseMacro from '../base-macro.js';
|
|
16
16
|
import type TaskQueue from '../task-queue.js';
|
|
17
|
-
export interface ScoreCardOptions {
|
|
18
|
-
value: number;
|
|
19
|
-
legend?: string;
|
|
20
|
-
title?: string;
|
|
21
|
-
unit?: string;
|
|
22
|
-
}
|
|
23
17
|
declare class ScoreCardMacro extends BaseMacro {
|
|
24
18
|
constructor(tasksQueue: TaskQueue);
|
|
25
19
|
handleValidate: (_: MacroGenerationContext, data: string) => void;
|
|
@@ -1 +1 @@
|
|
|
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;
|
|
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;AAG/C,MAAM,cAAe,SAAQ,SAAS;IACpC,YAAY,UAAqB;QAC/B,KAAK,CAAC,aAAa,EAAE,UAAU,CAAC,CAAC;IACnC,CAAC;IACD,cAAc,GAAG,CAAC,CAAyB,EAAE,IAAY,EAAE,EAAE;QAC3D,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"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
Cyberismo
|
|
3
|
+
Copyright © Cyberismo Ltd and contributors 2025
|
|
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
|
+
export interface ScoreCardOptions {
|
|
15
|
+
/**
|
|
16
|
+
* Value shown in score card
|
|
17
|
+
*/
|
|
18
|
+
value: number;
|
|
19
|
+
/**
|
|
20
|
+
* Optional legend text
|
|
21
|
+
*/
|
|
22
|
+
legend?: string;
|
|
23
|
+
/**
|
|
24
|
+
* Option title text
|
|
25
|
+
*/
|
|
26
|
+
title?: string;
|
|
27
|
+
/**
|
|
28
|
+
* Option unit that is next to the value
|
|
29
|
+
*/
|
|
30
|
+
unit?: string;
|
|
31
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
Cyberismo
|
|
3
|
+
Copyright © Cyberismo Ltd and contributors 2025
|
|
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
|
+
export {};
|
|
15
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/macros/scoreCard/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;EAYE"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
Cyberismo
|
|
3
|
+
Copyright © Cyberismo Ltd and contributors 2025
|
|
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 { CreateCardsOptions } from './createCards/types.js';
|
|
15
|
+
import { GraphOptions } from './graph/types.js';
|
|
16
|
+
import { ImageMacroOptions } from './image/types.js';
|
|
17
|
+
import { IncludeMacroOptions } from './include/types.js';
|
|
18
|
+
import { PercentageOptions } from './percentage/types.js';
|
|
19
|
+
import { ReportOptions } from './report/types.js';
|
|
20
|
+
import { ScoreCardOptions } from './scoreCard/types.js';
|
|
21
|
+
import { VegaMacroInput } from './vega/types.js';
|
|
22
|
+
import { VegaLiteMacroInput } from './vegalite/types.js';
|
|
23
|
+
import { XrefMacroOptions } from './xref/types.js';
|
|
24
|
+
export type AnyMacroOption = CreateCardsOptions | GraphOptions | ImageMacroOptions | IncludeMacroOptions | PercentageOptions | ReportOptions | ScoreCardOptions | VegaMacroInput | VegaLiteMacroInput | XrefMacroOptions;
|
|
25
|
+
export { CreateCardsOptions, GraphOptions, ImageMacroOptions, IncludeMacroOptions, PercentageOptions, ReportOptions, ScoreCardOptions, VegaMacroInput, VegaLiteMacroInput, XrefMacroOptions, };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/macros/types.ts"],"names":[],"mappings":""}
|
|
@@ -14,10 +14,6 @@
|
|
|
14
14
|
import type { MacroGenerationContext } from '../../interfaces/macros.js';
|
|
15
15
|
import BaseMacro from '../base-macro.js';
|
|
16
16
|
import type TaskQueue from '../task-queue.js';
|
|
17
|
-
import * as vega from 'vega';
|
|
18
|
-
export interface VegaMacroInput {
|
|
19
|
-
spec: vega.Spec;
|
|
20
|
-
}
|
|
21
17
|
declare class VegaMacro extends BaseMacro {
|
|
22
18
|
constructor(tasksQueue: TaskQueue);
|
|
23
19
|
handleValidate: (_: MacroGenerationContext, input: unknown) => void;
|
|
@@ -1 +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;
|
|
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;AAG7B,MAAM,SAAU,SAAQ,SAAS;IAC/B,YAAY,UAAqB;QAC/B,KAAK,CAAC,aAAa,EAAE,UAAU,CAAC,CAAC;IACnC,CAAC;IAED,cAAc,GAAG,CAAC,CAAyB,EAAE,KAAc,EAAE,EAAE;QAC7D,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,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
Cyberismo
|
|
3
|
+
Copyright © Cyberismo Ltd and contributors 2025
|
|
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 { Spec } from 'vega';
|
|
15
|
+
export interface VegaMacroInput {
|
|
16
|
+
/**
|
|
17
|
+
* Defines spec for vega
|
|
18
|
+
*/
|
|
19
|
+
spec: Spec;
|
|
20
|
+
}
|