@cyberismo/data-handler 0.0.8 → 0.0.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/command-handler.d.ts +11 -2
- package/dist/command-handler.js +61 -18
- package/dist/command-handler.js.map +1 -1
- package/dist/command-manager.js +8 -8
- package/dist/command-manager.js.map +1 -1
- package/dist/commands/calculate.d.ts +7 -44
- package/dist/commands/calculate.js +8 -389
- package/dist/commands/calculate.js.map +1 -1
- package/dist/commands/create.d.ts +6 -3
- package/dist/commands/create.js +27 -5
- package/dist/commands/create.js.map +1 -1
- package/dist/commands/edit.d.ts +15 -3
- package/dist/commands/edit.js +52 -9
- package/dist/commands/edit.js.map +1 -1
- package/dist/commands/export.d.ts +11 -9
- package/dist/commands/export.js +80 -28
- package/dist/commands/export.js.map +1 -1
- package/dist/commands/import.d.ts +7 -0
- package/dist/commands/import.js +13 -0
- package/dist/commands/import.js.map +1 -1
- package/dist/commands/move.d.ts +11 -12
- package/dist/commands/move.js +12 -13
- package/dist/commands/move.js.map +1 -1
- package/dist/commands/remove.d.ts +1 -3
- package/dist/commands/remove.js +4 -6
- package/dist/commands/remove.js.map +1 -1
- package/dist/commands/rename.d.ts +1 -3
- package/dist/commands/rename.js +3 -6
- package/dist/commands/rename.js.map +1 -1
- package/dist/commands/show.d.ts +37 -5
- package/dist/commands/show.js +89 -8
- package/dist/commands/show.js.map +1 -1
- package/dist/commands/transition.d.ts +1 -3
- package/dist/commands/transition.js +3 -5
- package/dist/commands/transition.js.map +1 -1
- package/dist/commands/update.d.ts +5 -1
- package/dist/commands/update.js +7 -1
- package/dist/commands/update.js.map +1 -1
- package/dist/commands/validate.d.ts +7 -0
- package/dist/commands/validate.js +31 -4
- package/dist/commands/validate.js.map +1 -1
- package/dist/containers/card-container.d.ts +6 -0
- package/dist/containers/card-container.js +61 -0
- package/dist/containers/card-container.js.map +1 -1
- package/dist/containers/project/calculation-engine.d.ts +90 -0
- package/dist/containers/project/calculation-engine.js +402 -0
- package/dist/containers/project/calculation-engine.js.map +1 -0
- package/dist/containers/project/resource-collector.js +9 -13
- package/dist/containers/project/resource-collector.js.map +1 -1
- package/dist/containers/project.d.ts +18 -1
- package/dist/containers/project.js +28 -55
- package/dist/containers/project.js.map +1 -1
- package/dist/containers/template.d.ts +5 -0
- package/dist/containers/template.js +9 -0
- package/dist/containers/template.js.map +1 -1
- package/dist/index.d.ts +5 -2
- package/dist/index.js +5 -1
- package/dist/index.js.map +1 -1
- package/dist/interfaces/macros.d.ts +4 -2
- package/dist/interfaces/project-interfaces.d.ts +21 -0
- package/dist/interfaces/project-interfaces.js +4 -0
- package/dist/interfaces/project-interfaces.js.map +1 -1
- package/dist/interfaces/resource-interfaces.d.ts +4 -2
- package/dist/interfaces/resource-interfaces.js.map +1 -1
- package/dist/macros/base-macro.d.ts +2 -1
- package/dist/macros/base-macro.js +14 -2
- package/dist/macros/base-macro.js.map +1 -1
- package/dist/macros/common.d.ts +16 -9
- package/dist/macros/common.js +22 -9
- package/dist/macros/common.js.map +1 -1
- package/dist/macros/createCards/index.d.ts +2 -2
- package/dist/macros/createCards/index.js +4 -0
- package/dist/macros/createCards/index.js.map +1 -1
- package/dist/macros/graph/index.d.ts +1 -3
- package/dist/macros/graph/index.js +1 -6
- package/dist/macros/graph/index.js.map +1 -1
- package/dist/macros/image/index.d.ts +39 -0
- package/dist/macros/image/index.js +82 -0
- package/dist/macros/image/index.js.map +1 -0
- package/dist/macros/image/metadata.d.ts +18 -0
- package/dist/macros/image/metadata.js +22 -0
- package/dist/macros/image/metadata.js.map +1 -0
- package/dist/macros/include/index.d.ts +31 -0
- package/dist/macros/include/index.js +94 -0
- package/dist/macros/include/index.js.map +1 -0
- package/dist/macros/include/metadata.d.ts +15 -0
- package/dist/macros/include/metadata.js +19 -0
- package/dist/macros/include/metadata.js.map +1 -0
- package/dist/macros/index.d.ts +33 -31
- package/dist/macros/index.js +142 -71
- package/dist/macros/index.js.map +1 -1
- package/dist/macros/percentage/index.d.ts +28 -0
- package/dist/macros/percentage/index.js +33 -0
- package/dist/macros/percentage/index.js.map +1 -0
- package/dist/macros/percentage/metadata.d.ts +15 -0
- package/dist/macros/percentage/metadata.js +19 -0
- package/dist/macros/percentage/metadata.js.map +1 -0
- package/dist/macros/report/index.d.ts +2 -6
- package/dist/macros/report/index.js +3 -7
- package/dist/macros/report/index.js.map +1 -1
- package/dist/macros/scoreCard/index.d.ts +14 -15
- package/dist/macros/scoreCard/index.js +14 -18
- package/dist/macros/scoreCard/index.js.map +1 -1
- package/dist/macros/vega/index.d.ts +28 -0
- package/dist/macros/vega/index.js +27 -0
- package/dist/macros/vega/index.js.map +1 -0
- package/dist/macros/vega/metadata.d.ts +15 -0
- package/dist/macros/vega/metadata.js +7 -0
- package/dist/macros/vega/metadata.js.map +1 -0
- package/dist/macros/vegalite/index.d.ts +26 -0
- package/dist/macros/vegalite/index.js +24 -0
- package/dist/macros/vegalite/index.js.map +1 -0
- package/dist/macros/vegalite/metadata.d.ts +15 -0
- package/dist/macros/vegalite/metadata.js +7 -0
- package/dist/macros/vegalite/metadata.js.map +1 -0
- package/dist/macros/xref/index.d.ts +26 -0
- package/dist/macros/xref/index.js +53 -0
- package/dist/macros/xref/index.js.map +1 -0
- package/dist/macros/xref/metadata.d.ts +15 -0
- package/dist/macros/xref/metadata.js +19 -0
- package/dist/macros/xref/metadata.js.map +1 -0
- package/dist/module-manager.d.ts +1 -0
- package/dist/module-manager.js +14 -4
- package/dist/module-manager.js.map +1 -1
- package/dist/permissions/action-guard.d.ts +2 -2
- package/dist/permissions/action-guard.js +1 -1
- package/dist/permissions/action-guard.js.map +1 -1
- package/dist/resources/card-type-resource.d.ts +2 -0
- package/dist/resources/card-type-resource.js +63 -0
- package/dist/resources/card-type-resource.js.map +1 -1
- package/dist/resources/file-resource.d.ts +2 -0
- package/dist/resources/file-resource.js +12 -4
- package/dist/resources/file-resource.js.map +1 -1
- package/dist/resources/folder-resource.d.ts +19 -0
- package/dist/resources/folder-resource.js +51 -2
- package/dist/resources/folder-resource.js.map +1 -1
- package/dist/resources/graph-model-resource.js +1 -1
- package/dist/resources/graph-model-resource.js.map +1 -1
- package/dist/resources/graph-view-resource.js +1 -1
- package/dist/resources/graph-view-resource.js.map +1 -1
- package/dist/resources/report-resource.js +1 -1
- package/dist/resources/report-resource.js.map +1 -1
- package/dist/resources/resource-object.d.ts +8 -0
- package/dist/resources/resource-object.js +10 -1
- package/dist/resources/resource-object.js.map +1 -1
- package/dist/resources/template-resource.js +1 -1
- package/dist/resources/template-resource.js.map +1 -1
- package/dist/resources/workflow-resource.d.ts +2 -0
- package/dist/resources/workflow-resource.js +53 -9
- package/dist/resources/workflow-resource.js.map +1 -1
- package/dist/svg/index.d.ts +15 -0
- package/dist/svg/index.js +16 -0
- package/dist/svg/index.js.map +1 -0
- package/dist/svg/lib.d.ts +9 -0
- package/dist/svg/lib.js +26 -0
- package/dist/svg/lib.js.map +1 -0
- package/dist/svg/percentage.d.ts +25 -0
- package/dist/svg/percentage.js +90 -0
- package/dist/svg/percentage.js.map +1 -0
- package/dist/svg/scoreCard.d.ts +19 -0
- package/dist/svg/scoreCard.js +55 -0
- package/dist/svg/scoreCard.js.map +1 -0
- package/dist/types/queries.d.ts +8 -7
- package/dist/types/queries.js.map +1 -1
- package/dist/utils/card-utils.d.ts +6 -0
- package/dist/utils/card-utils.js +12 -0
- package/dist/utils/card-utils.js.map +1 -1
- package/dist/utils/clingo-facts.d.ts +2 -1
- package/dist/utils/clingo-facts.js +19 -2
- package/dist/utils/clingo-facts.js.map +1 -1
- package/dist/utils/clingo-parser.d.ts +1 -0
- package/dist/utils/clingo-parser.js +22 -100
- package/dist/utils/clingo-parser.js.map +1 -1
- package/dist/utils/constants.d.ts +7 -0
- package/dist/utils/constants.js +14 -0
- package/dist/utils/constants.js.map +1 -1
- package/dist/utils/csv.js.map +1 -1
- package/dist/utils/report.d.ts +17 -3
- package/dist/utils/report.js +38 -2
- package/dist/utils/report.js.map +1 -1
- package/dist/utils/resource-utils.d.ts +2 -1
- package/dist/utils/resource-utils.js +12 -3
- package/dist/utils/resource-utils.js.map +1 -1
- package/dist/utils/user-preferences.d.ts +1 -11
- package/dist/utils/user-preferences.js +30 -13
- package/dist/utils/user-preferences.js.map +1 -1
- package/dist/utils/validate.d.ts +2 -3
- package/dist/utils/validate.js +2 -2
- package/dist/utils/validate.js.map +1 -1
- package/package.json +8 -6
- package/src/command-handler.ts +96 -17
- package/src/command-manager.ts +8 -8
- package/src/commands/calculate.ts +11 -525
- package/src/commands/create.ts +35 -6
- package/src/commands/edit.ts +94 -11
- package/src/commands/export.ts +104 -31
- package/src/commands/import.ts +16 -0
- package/src/commands/move.ts +12 -15
- package/src/commands/remove.ts +4 -8
- package/src/commands/rename.ts +3 -12
- package/src/commands/show.ts +126 -9
- package/src/commands/transition.ts +3 -7
- package/src/commands/update.ts +6 -0
- package/src/commands/validate.ts +41 -13
- package/src/containers/card-container.ts +74 -0
- package/src/containers/project/calculation-engine.ts +535 -0
- package/src/containers/project/resource-collector.ts +13 -15
- package/src/containers/project.ts +30 -66
- package/src/containers/template.ts +16 -0
- package/src/index.ts +13 -2
- package/src/interfaces/macros.ts +4 -1
- package/src/interfaces/project-interfaces.ts +27 -0
- package/src/interfaces/resource-interfaces.ts +5 -2
- package/src/macros/base-macro.ts +19 -4
- package/src/macros/common.ts +22 -9
- package/src/macros/createCards/index.ts +6 -2
- package/src/macros/graph/index.ts +6 -10
- package/src/macros/image/index.ts +128 -0
- package/src/macros/image/metadata.ts +25 -0
- package/src/macros/include/index.ts +143 -0
- package/src/macros/include/metadata.ts +22 -0
- package/src/macros/index.ts +150 -98
- package/src/macros/percentage/index.ts +50 -0
- package/src/macros/percentage/metadata.ts +22 -0
- package/src/macros/report/index.ts +4 -12
- package/src/macros/scoreCard/index.ts +21 -25
- package/src/macros/vega/index.ts +55 -0
- package/src/macros/vega/metadata.ts +21 -0
- package/src/macros/vegalite/index.ts +46 -0
- package/src/macros/vegalite/metadata.ts +21 -0
- package/src/macros/xref/index.ts +73 -0
- package/src/macros/xref/metadata.ts +22 -0
- package/src/module-manager.ts +15 -5
- package/src/permissions/action-guard.ts +3 -3
- package/src/resources/card-type-resource.ts +100 -0
- package/src/resources/file-resource.ts +16 -4
- package/src/resources/folder-resource.ts +59 -2
- package/src/resources/graph-model-resource.ts +1 -1
- package/src/resources/graph-view-resource.ts +1 -1
- package/src/resources/report-resource.ts +1 -1
- package/src/resources/resource-object.ts +19 -1
- package/src/resources/template-resource.ts +1 -1
- package/src/resources/workflow-resource.ts +68 -13
- package/src/svg/index.ts +15 -0
- package/src/svg/lib.ts +31 -0
- package/src/svg/percentage.ts +97 -0
- package/src/svg/scoreCard.ts +88 -0
- package/src/types/queries.ts +8 -7
- package/src/types/string-pixel-width.d.ts +23 -0
- package/src/utils/card-utils.ts +13 -0
- package/src/utils/clingo-facts.ts +65 -3
- package/src/utils/clingo-parser.ts +31 -144
- package/src/utils/constants.ts +16 -0
- package/src/utils/csv.ts +1 -1
- package/src/utils/report.ts +45 -4
- package/src/utils/resource-utils.ts +12 -2
- package/src/utils/user-preferences.ts +32 -14
- package/src/utils/validate.ts +3 -3
package/dist/macros/common.js
CHANGED
|
@@ -1,23 +1,36 @@
|
|
|
1
1
|
/**
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
2
|
+
Cyberismo
|
|
3
|
+
Copyright © Cyberismo Ltd and contributors 2024
|
|
4
|
+
This program is free software: you can redistribute it and/or modify it under
|
|
5
|
+
the terms of the GNU Affero General Public License version 3 as published by
|
|
6
|
+
the Free Software Foundation.
|
|
7
|
+
This program is distributed in the hope that it will be useful, but WITHOUT
|
|
8
|
+
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
|
9
|
+
FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
|
|
10
|
+
details. You should have received a copy of the GNU Affero General Public
|
|
11
|
+
License along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
11
12
|
*/
|
|
12
13
|
// important that this file imports only the metadata
|
|
13
14
|
import createCards from './createCards/metadata.js';
|
|
14
15
|
import graph from './graph/metadata.js';
|
|
16
|
+
import image from './image/metadata.js';
|
|
17
|
+
import include from './include/metadata.js';
|
|
15
18
|
import report from './report/metadata.js';
|
|
16
19
|
import scoreCard from './scoreCard/metadata.js';
|
|
20
|
+
import xref from './xref/metadata.js';
|
|
21
|
+
import percentage from './percentage/metadata.js';
|
|
22
|
+
import vega from './vega/metadata.js';
|
|
23
|
+
import vegaLite from './vegalite/metadata.js';
|
|
17
24
|
export const macroMetadata = {
|
|
18
25
|
createCards,
|
|
19
26
|
graph,
|
|
27
|
+
image,
|
|
28
|
+
include,
|
|
20
29
|
report,
|
|
21
30
|
scoreCard,
|
|
31
|
+
xref,
|
|
32
|
+
percentage,
|
|
33
|
+
vega,
|
|
34
|
+
vegaLite,
|
|
22
35
|
};
|
|
23
36
|
//# sourceMappingURL=common.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"common.js","sourceRoot":"","sources":["../../src/macros/common.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"common.js","sourceRoot":"","sources":["../../src/macros/common.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;EAWE;AAEF,qDAAqD;AACrD,OAAO,WAAW,MAAM,2BAA2B,CAAC;AACpD,OAAO,KAAK,MAAM,qBAAqB,CAAC;AACxC,OAAO,KAAK,MAAM,qBAAqB,CAAC;AACxC,OAAO,OAAO,MAAM,uBAAuB,CAAC;AAC5C,OAAO,MAAM,MAAM,sBAAsB,CAAC;AAC1C,OAAO,SAAS,MAAM,yBAAyB,CAAC;AAChD,OAAO,IAAI,MAAM,oBAAoB,CAAC;AACtC,OAAO,UAAU,MAAM,0BAA0B,CAAC;AAClD,OAAO,IAAI,MAAM,oBAAoB,CAAC;AACtC,OAAO,QAAQ,MAAM,wBAAwB,CAAC;AAE9C,MAAM,CAAC,MAAM,aAAa,GAAG;IAC3B,WAAW;IACX,KAAK;IACL,KAAK;IACL,OAAO;IACP,MAAM;IACN,SAAS;IACT,IAAI;IACJ,UAAU;IACV,IAAI;IACJ,QAAQ;CACT,CAAC"}
|
|
@@ -9,11 +9,10 @@
|
|
|
9
9
|
You should have received a copy of the GNU Affero General Public
|
|
10
10
|
License along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
11
11
|
*/
|
|
12
|
-
import type { MacroOptions } from '../index.js';
|
|
13
12
|
import type { MacroGenerationContext } from '../../interfaces/macros.js';
|
|
14
13
|
import BaseMacro from '../base-macro.js';
|
|
15
14
|
import type TaskQueue from '../task-queue.js';
|
|
16
|
-
export interface CreateCardsOptions
|
|
15
|
+
export interface CreateCardsOptions {
|
|
17
16
|
buttonLabel: string;
|
|
18
17
|
template: string;
|
|
19
18
|
cardKey?: string;
|
|
@@ -31,6 +30,7 @@ declare class CreateCardsMacro extends BaseMacro {
|
|
|
31
30
|
handleValidate: (input: unknown) => void;
|
|
32
31
|
handleStatic(): Promise<string>;
|
|
33
32
|
handleInject: (_: MacroGenerationContext, input: unknown) => Promise<string>;
|
|
33
|
+
handleStaticSite: () => Promise<string>;
|
|
34
34
|
private validate;
|
|
35
35
|
}
|
|
36
36
|
export default CreateCardsMacro;
|
|
@@ -27,6 +27,10 @@ class CreateCardsMacro extends BaseMacro {
|
|
|
27
27
|
const options = this.validate(input);
|
|
28
28
|
return createHtmlPlaceholder(this.metadata, options);
|
|
29
29
|
};
|
|
30
|
+
handleStaticSite = async () => {
|
|
31
|
+
// export site does not support createCards
|
|
32
|
+
return '';
|
|
33
|
+
};
|
|
30
34
|
validate(input) {
|
|
31
35
|
return validateMacroContent(this.metadata, input);
|
|
32
36
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/macros/createCards/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;EAUE;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/macros/createCards/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;EAUE;AAEF,OAAO,EAAE,qBAAqB,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAG1E,OAAO,aAAa,MAAM,eAAe,CAAC;AAC1C,OAAO,SAAS,MAAM,kBAAkB,CAAC;AAezC,MAAM,gBAAiB,SAAQ,SAAS;IACtC,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,KAAK,CAAC,YAAY;QAChB,0CAA0C;QAC1C,OAAO,EAAE,CAAC;IACZ,CAAC;IAED,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;IAEF,gBAAgB,GAAG,KAAK,IAAI,EAAE;QAC5B,2CAA2C;QAC3C,OAAO,EAAE,CAAC;IACZ,CAAC,CAAC;IAEM,QAAQ,CAAC,KAAc;QAC7B,OAAO,oBAAoB,CAAqB,IAAI,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC;IACxE,CAAC;CACF;AAED,eAAe,gBAAgB,CAAC"}
|
|
@@ -11,10 +11,9 @@
|
|
|
11
11
|
License along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
12
12
|
*/
|
|
13
13
|
import BaseMacro from '../base-macro.js';
|
|
14
|
-
import type { MacroOptions } from '../index.js';
|
|
15
14
|
import type { MacroGenerationContext } from '../../interfaces/macros.js';
|
|
16
15
|
import type TaskQueue from '../task-queue.js';
|
|
17
|
-
export interface GraphOptions
|
|
16
|
+
export interface GraphOptions {
|
|
18
17
|
model: string;
|
|
19
18
|
view: string;
|
|
20
19
|
}
|
|
@@ -22,7 +21,6 @@ declare class ReportMacro extends BaseMacro {
|
|
|
22
21
|
constructor(tasksQueue: TaskQueue);
|
|
23
22
|
handleValidate: (input: unknown) => void;
|
|
24
23
|
handleStatic: (context: MacroGenerationContext, input: unknown) => Promise<string>;
|
|
25
|
-
handleInject: (context: MacroGenerationContext, input: unknown) => Promise<string>;
|
|
26
24
|
private parseOptions;
|
|
27
25
|
}
|
|
28
26
|
export default ReportMacro;
|
|
@@ -11,7 +11,6 @@
|
|
|
11
11
|
License along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
12
12
|
*/
|
|
13
13
|
import BaseMacro from '../base-macro.js';
|
|
14
|
-
import { Calculate } from '../../commands/index.js';
|
|
15
14
|
import { createImage, validateMacroContent } from '../index.js';
|
|
16
15
|
import Handlebars from 'handlebars';
|
|
17
16
|
import { join } from 'node:path';
|
|
@@ -29,10 +28,6 @@ class ReportMacro extends BaseMacro {
|
|
|
29
28
|
this.parseOptions(input);
|
|
30
29
|
};
|
|
31
30
|
handleStatic = async (context, input) => {
|
|
32
|
-
return this.handleInject(context, input);
|
|
33
|
-
};
|
|
34
|
-
handleInject = async (context, input) => {
|
|
35
|
-
const calculate = new Calculate(context.project);
|
|
36
31
|
const resourceNameToPath = (name, fileName) => {
|
|
37
32
|
const { identifier, prefix, type } = resourceName(name);
|
|
38
33
|
if (prefix === context.project.projectPrefix) {
|
|
@@ -74,7 +69,7 @@ class ReportMacro extends BaseMacro {
|
|
|
74
69
|
const modelContent = await readFile(modelLocation, { encoding: 'utf-8' });
|
|
75
70
|
let result;
|
|
76
71
|
try {
|
|
77
|
-
result = await
|
|
72
|
+
result = await context.project.calculationEngine.runGraph(modelContent, view, context.context);
|
|
78
73
|
}
|
|
79
74
|
catch (error) {
|
|
80
75
|
if (error instanceof ClingoError) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/macros/graph/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;EAWE;AAEF,OAAO,SAAS,MAAM,kBAAkB,CAAC;AACzC,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/macros/graph/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;EAWE;AAEF,OAAO,SAAS,MAAM,kBAAkB,CAAC;AACzC,OAAO,EAAE,WAAW,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAChE,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,OAAO,aAAa,MAAM,eAAe,CAAC;AAC1C,OAAO,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AACvD,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAE7D,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAEvD,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAOrD,MAAM,WAAY,SAAQ,SAAS;IACjC,YAAY,UAAqB;QAC/B,KAAK,CAAC,aAAa,EAAE,UAAU,CAAC,CAAC;IACnC,CAAC;IAED,cAAc,GAAG,CAAC,KAAc,EAAE,EAAE;QAClC,IAAI,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC;IAC3B,CAAC,CAAC;IAEF,YAAY,GAAG,KAAK,EAAE,OAA+B,EAAE,KAAc,EAAE,EAAE;QACvE,MAAM,kBAAkB,GAAG,CAAC,IAAY,EAAE,QAAgB,EAAE,EAAE;YAC5D,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,YAAY,CAAC,IAAI,CAAC,CAAC;YACxD,IAAI,MAAM,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;CACF;AAED,eAAe,WAAW,CAAC"}
|
|
@@ -0,0 +1,39 @@
|
|
|
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
|
+
/**
|
|
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
|
+
/**
|
|
30
|
+
* Macro for including images in the content
|
|
31
|
+
*/
|
|
32
|
+
export default class ImageMacro extends BaseMacro {
|
|
33
|
+
constructor(tasksQueue: TaskQueue);
|
|
34
|
+
handleValidate: (input: unknown) => void;
|
|
35
|
+
handleStatic: (context: MacroGenerationContext, input: unknown) => Promise<string>;
|
|
36
|
+
handleInject: (context: MacroGenerationContext, input: unknown) => Promise<string>;
|
|
37
|
+
private buildImageAttributes;
|
|
38
|
+
private validate;
|
|
39
|
+
}
|
|
@@ -0,0 +1,82 @@
|
|
|
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 { existsSync, readFileSync } from 'node:fs';
|
|
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
|
+
import BaseMacro from '../base-macro.js';
|
|
19
|
+
/**
|
|
20
|
+
* Macro for including images in the content
|
|
21
|
+
*/
|
|
22
|
+
export default class ImageMacro extends BaseMacro {
|
|
23
|
+
constructor(tasksQueue) {
|
|
24
|
+
super(macroMetadata, tasksQueue);
|
|
25
|
+
}
|
|
26
|
+
handleValidate = (input) => {
|
|
27
|
+
this.validate(input);
|
|
28
|
+
};
|
|
29
|
+
handleStatic = async (context, input) => {
|
|
30
|
+
const options = this.validate(input);
|
|
31
|
+
const cardKey = options.cardKey || context.cardKey;
|
|
32
|
+
// Get the attachment folder path
|
|
33
|
+
const attachmentFolder = await context.project.cardAttachmentFolder(cardKey);
|
|
34
|
+
if (!attachmentFolder) {
|
|
35
|
+
throw new Error(`Card '${cardKey}' not found`);
|
|
36
|
+
}
|
|
37
|
+
// Read the file and convert to base64
|
|
38
|
+
const attachmentPath = join(attachmentFolder, options.fileName);
|
|
39
|
+
if (!existsSync(attachmentPath)) {
|
|
40
|
+
throw new Error(`Attachment file '${options.fileName}' not found in card '${cardKey}'`);
|
|
41
|
+
}
|
|
42
|
+
const fileBuffer = readFileSync(attachmentPath);
|
|
43
|
+
const base64Data = fileBuffer.toString('base64');
|
|
44
|
+
// Get mime type
|
|
45
|
+
const mimeType = mime.lookup(attachmentPath) || 'application/octet-stream';
|
|
46
|
+
// Build image attributes
|
|
47
|
+
const attributes = this.buildImageAttributes(options);
|
|
48
|
+
// Return as data URI for static mode (for export/PDF generation)
|
|
49
|
+
return `image::data:${mimeType};base64,${base64Data}[${attributes}]`;
|
|
50
|
+
};
|
|
51
|
+
handleInject = async (context, input) => {
|
|
52
|
+
const options = this.validate(input);
|
|
53
|
+
const cardKey = options.cardKey || context.cardKey;
|
|
54
|
+
// Verify that the card and attachment folder exist
|
|
55
|
+
const attachmentFolder = await context.project.cardAttachmentFolder(cardKey);
|
|
56
|
+
if (!attachmentFolder) {
|
|
57
|
+
throw new Error(`Card '${cardKey}' not found`);
|
|
58
|
+
}
|
|
59
|
+
const attachmentPath = join(attachmentFolder, options.fileName);
|
|
60
|
+
if (!existsSync(attachmentPath)) {
|
|
61
|
+
throw new Error(`Attachment file '${options.fileName}' not found in card '${cardKey}'`);
|
|
62
|
+
}
|
|
63
|
+
// Build image attributes
|
|
64
|
+
const attributes = this.buildImageAttributes(options);
|
|
65
|
+
// In inject mode, always use the API path for consistency
|
|
66
|
+
return `image::/api/cards/${cardKey}/a/${options.fileName}[${attributes}]`;
|
|
67
|
+
};
|
|
68
|
+
buildImageAttributes(options) {
|
|
69
|
+
const attributes = [];
|
|
70
|
+
if (options.alt !== undefined) {
|
|
71
|
+
attributes.push(`alt="${options.alt}"`);
|
|
72
|
+
}
|
|
73
|
+
if (options.title !== undefined) {
|
|
74
|
+
attributes.push(`title="${options.title}"`);
|
|
75
|
+
}
|
|
76
|
+
return attributes.join(',');
|
|
77
|
+
}
|
|
78
|
+
validate(input) {
|
|
79
|
+
return validateMacroContent(this.metadata, input);
|
|
80
|
+
}
|
|
81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oB,CAAC,OAAO,CAAC,CAAC;QAEtD,0DAA0D;QAC1D,OAAO,qBAAqB,OAAO,MAAM,OAAO,CAAC,QAAQ,IAAI,UAAU,GAAG,CAAC;IAC7E,CAAC,CAAC;IAEM,oBAAoB,CAAC,OAA0B;QACrD,MAAM,UAAU,GAAa,EAAE,CAAC;QAEhC,IAAI,OAAO,CAAC,GAAG,KAAK,SAAS,EAAE,CAAC;YAC9B,UAAU,CAAC,IAAI,CAAC,QAAQ,OAAO,CAAC,GAAG,GAAG,CAAC,CAAC;QAC1C,CAAC;QAED,IAAI,OAAO,CAAC,KAAK,KAAK,SAAS,EAAE,CAAC;YAChC,UAAU,CAAC,IAAI,CAAC,UAAU,OAAO,CAAC,KAAK,GAAG,CAAC,CAAC;QAC9C,CAAC;QAED,OAAO,UAAU,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAC9B,CAAC;IAEO,QAAQ,CAAC,KAAc;QAC7B,OAAO,oBAAoB,CAAoB,IAAI,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC;IACvE,CAAC;CACF"}
|
|
@@ -0,0 +1,18 @@
|
|
|
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
|
+
/**
|
|
15
|
+
* Metadata for the image macro.
|
|
16
|
+
*/
|
|
17
|
+
declare const macroMetadata: MacroMetadata;
|
|
18
|
+
export default macroMetadata;
|
|
@@ -0,0 +1,22 @@
|
|
|
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
|
+
/**
|
|
14
|
+
* Metadata for the image macro.
|
|
15
|
+
*/
|
|
16
|
+
const macroMetadata = {
|
|
17
|
+
name: 'image',
|
|
18
|
+
tagName: 'image',
|
|
19
|
+
schema: 'imageMacroSchema',
|
|
20
|
+
};
|
|
21
|
+
export default macroMetadata;
|
|
22
|
+
//# sourceMappingURL=metadata.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"metadata.js","sourceRoot":"","sources":["../../../src/macros/image/metadata.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;EAWE;AAIF;;GAEG;AACH,MAAM,aAAa,GAAkB;IACnC,IAAI,EAAE,OAAO;IACb,OAAO,EAAE,OAAO;IAChB,MAAM,EAAE,kBAAkB;CAC3B,CAAC;AAEF,eAAe,aAAa,CAAC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
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 IncludeMacroOptions {
|
|
17
|
+
cardKey: string;
|
|
18
|
+
levelOffset?: string;
|
|
19
|
+
title?: 'include' | 'exclude' | 'only';
|
|
20
|
+
pageTitles?: 'normal' | 'discrete';
|
|
21
|
+
}
|
|
22
|
+
export default class IncludeMacro extends BaseMacro {
|
|
23
|
+
constructor(tasksQueue: TaskQueue);
|
|
24
|
+
handleValidate: (input: unknown) => void;
|
|
25
|
+
handleStatic: (context: MacroGenerationContext, input: unknown) => Promise<string>;
|
|
26
|
+
private validate;
|
|
27
|
+
private generateAnchor;
|
|
28
|
+
private generateTitle;
|
|
29
|
+
private generateCardContent;
|
|
30
|
+
private adjustTitles;
|
|
31
|
+
}
|
|
@@ -0,0 +1,94 @@
|
|
|
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 { evaluateMacros, validateMacroContent } from '../index.js';
|
|
14
|
+
import macroMetadata from './metadata.js';
|
|
15
|
+
import BaseMacro from '../base-macro.js';
|
|
16
|
+
import { MAX_LEVEL_OFFSET } from '../../utils/constants.js';
|
|
17
|
+
export default class IncludeMacro extends BaseMacro {
|
|
18
|
+
constructor(tasksQueue) {
|
|
19
|
+
super(macroMetadata, tasksQueue);
|
|
20
|
+
}
|
|
21
|
+
handleValidate = (input) => {
|
|
22
|
+
this.validate(input);
|
|
23
|
+
};
|
|
24
|
+
handleStatic = async (context, input) => {
|
|
25
|
+
const options = this.validate(input);
|
|
26
|
+
if (!options.title) {
|
|
27
|
+
options.title = 'include';
|
|
28
|
+
}
|
|
29
|
+
if (!options.pageTitles) {
|
|
30
|
+
options.pageTitles = 'normal';
|
|
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
|
+
const newContext = {
|
|
40
|
+
...context,
|
|
41
|
+
cardKey: options.cardKey,
|
|
42
|
+
};
|
|
43
|
+
const anchor = this.generateAnchor(options);
|
|
44
|
+
const title = this.generateTitle(options, card.metadata?.title);
|
|
45
|
+
const cardContent = await this.generateCardContent(options, card.content, newContext);
|
|
46
|
+
const content = `\n\n${anchor}${title}${cardContent}`;
|
|
47
|
+
let levelOffset = 0;
|
|
48
|
+
if (options.levelOffset) {
|
|
49
|
+
levelOffset = parseInt(options.levelOffset, 10);
|
|
50
|
+
if (isNaN(levelOffset)) {
|
|
51
|
+
throw new Error(`Invalid level offset: ${options.levelOffset}`);
|
|
52
|
+
}
|
|
53
|
+
levelOffset = Math.min(Math.max(levelOffset, -MAX_LEVEL_OFFSET), MAX_LEVEL_OFFSET);
|
|
54
|
+
}
|
|
55
|
+
const adjustedContent = this.adjustTitles(content, levelOffset, options.pageTitles === 'discrete');
|
|
56
|
+
return adjustedContent;
|
|
57
|
+
};
|
|
58
|
+
validate(input) {
|
|
59
|
+
return validateMacroContent(this.metadata, input);
|
|
60
|
+
}
|
|
61
|
+
generateAnchor(options) {
|
|
62
|
+
return options.title !== 'exclude' && options.pageTitles === 'normal'
|
|
63
|
+
? `[[${options.cardKey}]]\n`
|
|
64
|
+
: '';
|
|
65
|
+
}
|
|
66
|
+
generateTitle(options, cardTitle) {
|
|
67
|
+
if (options.title === 'only' || options.title === 'include') {
|
|
68
|
+
return `= ${cardTitle}\n\n`;
|
|
69
|
+
}
|
|
70
|
+
return '';
|
|
71
|
+
}
|
|
72
|
+
async generateCardContent(options, cardContent, context) {
|
|
73
|
+
if (options.title !== 'only') {
|
|
74
|
+
return await evaluateMacros(cardContent ?? '', context, true);
|
|
75
|
+
}
|
|
76
|
+
return '';
|
|
77
|
+
}
|
|
78
|
+
// Adjust asciidoc titles to match the level offset
|
|
79
|
+
adjustTitles(content, levelOffset, discrete) {
|
|
80
|
+
const lines = content.split('\n');
|
|
81
|
+
const adjustedLines = lines.map((line) => {
|
|
82
|
+
const match = line.match(/^(\s*)([=#]+)(.*?)\s*$/);
|
|
83
|
+
if (match) {
|
|
84
|
+
const currentLevel = match[2].length;
|
|
85
|
+
const newLevel = Math.min(Math.max(1, currentLevel + levelOffset), MAX_LEVEL_OFFSET + 1);
|
|
86
|
+
const equals = '='.repeat(newLevel);
|
|
87
|
+
return `${discrete ? '[discrete]\n' : ''}${match[1]}${equals} ${match[3].trim()}`;
|
|
88
|
+
}
|
|
89
|
+
return line;
|
|
90
|
+
});
|
|
91
|
+
return adjustedLines.join('\n');
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/macros/include/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;E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,CAAC,CAAC;IAClC,CAAC;CACF"}
|
|
@@ -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,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.
|
|
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
|
+
const macroMetadata = {
|
|
14
|
+
name: 'include',
|
|
15
|
+
tagName: 'include',
|
|
16
|
+
schema: 'includeMacroSchema',
|
|
17
|
+
};
|
|
18
|
+
export default macroMetadata;
|
|
19
|
+
//# sourceMappingURL=metadata.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"metadata.js","sourceRoot":"","sources":["../../../src/macros/include/metadata.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;EAWE;AAIF,MAAM,aAAa,GAAkB;IACnC,IAAI,EAAE,SAAS;IACf,OAAO,EAAE,SAAS;IAClB,MAAM,EAAE,oBAAoB;CAC7B,CAAC;AAEF,eAAe,aAAa,CAAC"}
|
package/dist/macros/index.d.ts
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
/**
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
2
|
+
Cyberismo
|
|
3
|
+
Copyright © Cyberismo Ltd and contributors 2024
|
|
4
|
+
This program is free software: you can redistribute it and/or modify it under
|
|
5
|
+
the terms of the GNU Affero General Public License version 3 as published by
|
|
6
|
+
the Free Software Foundation.
|
|
7
|
+
This program is distributed in the hope that it will be useful, but WITHOUT
|
|
8
|
+
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
|
9
|
+
FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
|
|
10
|
+
details. You should have received a copy of the GNU Affero General Public
|
|
11
|
+
License along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
11
12
|
*/
|
|
12
13
|
import Handlebars from 'handlebars';
|
|
13
14
|
import type { AdmonitionType } from '../interfaces/adoc.js';
|
|
14
|
-
import type { Validator } from 'jsonschema';
|
|
15
15
|
import type { MacroGenerationContext, MacroMetadata, MacroName } from '../interfaces/macros.js';
|
|
16
16
|
import type BaseMacro from './base-macro.js';
|
|
17
17
|
import TaskQueue from './task-queue.js';
|
|
18
|
-
import type {
|
|
18
|
+
import type { Schema } from 'jsonschema';
|
|
19
19
|
/**
|
|
20
20
|
* Constructor for all macros except report macros
|
|
21
21
|
*/
|
|
@@ -26,7 +26,7 @@ export interface SimpleMacroConstructor {
|
|
|
26
26
|
* Constructor for report macros
|
|
27
27
|
*/
|
|
28
28
|
export interface ReportMacroConstructor {
|
|
29
|
-
new (tasks: TaskQueue
|
|
29
|
+
new (tasks: TaskQueue): BaseMacro;
|
|
30
30
|
}
|
|
31
31
|
/**
|
|
32
32
|
* Constructor for all macros
|
|
@@ -39,15 +39,14 @@ export declare const macros: {
|
|
|
39
39
|
* Validates the content inside a macro
|
|
40
40
|
* @param macro - The macro to validate the content of
|
|
41
41
|
* @param data - The data to validate
|
|
42
|
-
* @param validator - The validator to use
|
|
43
42
|
* @returns The validated data
|
|
44
43
|
*/
|
|
45
|
-
export declare function validateMacroContent<T>(macro: MacroMetadata, data: unknown,
|
|
44
|
+
export declare function validateMacroContent<T>(macro: MacroMetadata, data: unknown, schema?: Schema): T;
|
|
46
45
|
/**
|
|
47
46
|
* Registers the macros with Handlebars
|
|
48
47
|
* @param {Mode} mode - The mode to register the macros in
|
|
49
48
|
*/
|
|
50
|
-
export declare function registerMacros(instance: typeof Handlebars, context: MacroGenerationContext, tasks: TaskQueue
|
|
49
|
+
export declare function registerMacros(instance: typeof Handlebars, context: MacroGenerationContext, tasks: TaskQueue): BaseMacro[];
|
|
51
50
|
/**
|
|
52
51
|
* Calculate amount of handlebars templates inside a string
|
|
53
52
|
* @param input
|
|
@@ -63,9 +62,11 @@ export declare function registerEmptyMacros(instance: typeof Handlebars): void;
|
|
|
63
62
|
/**
|
|
64
63
|
* Handle the macros in the content
|
|
65
64
|
* @param content - The content to handle the macros in
|
|
66
|
-
* @param
|
|
65
|
+
* @param context - The context for macro generation
|
|
66
|
+
* @param calculate - The calculate function
|
|
67
|
+
* @param preserveRawBlocks - If true, don't unescape raw blocks at the end (for nested evaluations)
|
|
67
68
|
*/
|
|
68
|
-
export declare function evaluateMacros(content: string, context: MacroGenerationContext,
|
|
69
|
+
export declare function evaluateMacros(content: string, context: MacroGenerationContext, preserveRawBlocks?: boolean): Promise<string>;
|
|
69
70
|
/**
|
|
70
71
|
* This function assumes that tasks, which were started by macros, are complete.
|
|
71
72
|
* It replaces the placeholders of the tasks with the actual results
|
|
@@ -83,20 +84,14 @@ export declare function applyMacroResults(input: string, tasks: TaskQueue, conte
|
|
|
83
84
|
* @returns The error message that is valid adoc
|
|
84
85
|
*/
|
|
85
86
|
export declare function handleMacroError(error: unknown, macro: string, context: MacroGenerationContext): string;
|
|
86
|
-
type Value = string | number | boolean | undefined;
|
|
87
|
-
/**
|
|
88
|
-
* Macro options can be a flat object or a nested object
|
|
89
|
-
* The nested object will be flattened into dot notation attributes
|
|
90
|
-
*/
|
|
91
|
-
export type MacroOptions = {
|
|
92
|
-
[key: string]: Value | MacroOptions;
|
|
93
|
-
};
|
|
94
87
|
/**
|
|
95
|
-
* Creates
|
|
96
|
-
*
|
|
97
|
-
* @param
|
|
88
|
+
* Creates a placeholder for a macro
|
|
89
|
+
* Options are encoded as base64
|
|
90
|
+
* @param macro - The macro to create a placeholder for
|
|
91
|
+
* @param options - The options for the macro
|
|
92
|
+
* @returns The placeholder for the macro
|
|
98
93
|
*/
|
|
99
|
-
export declare function createHtmlPlaceholder(macro: MacroMetadata, options:
|
|
94
|
+
export declare function createHtmlPlaceholder(macro: MacroMetadata, options: unknown): string;
|
|
100
95
|
/**
|
|
101
96
|
* Creates an adoc admonition
|
|
102
97
|
* @param type - The type of admonition
|
|
@@ -116,5 +111,12 @@ export declare function createCodeBlock(content: string): string;
|
|
|
116
111
|
* @param image base64 encoded image
|
|
117
112
|
* @returns valid asciidoc with the image
|
|
118
113
|
*/
|
|
119
|
-
export declare function createImage(image: string): string;
|
|
120
|
-
|
|
114
|
+
export declare function createImage(image: string, controls?: boolean): string;
|
|
115
|
+
/**
|
|
116
|
+
* Creates a Handlebars macro block string with the given macro name and options.
|
|
117
|
+
*
|
|
118
|
+
* @param macro - The name of the macro to create (e.g., 'scoreCard', 'include').
|
|
119
|
+
* @param options - The options object to be stringified and inserted as macro content.
|
|
120
|
+
* @returns The Handlebars macro block as a string, e.g. {{#macro}}...{{/macro}}
|
|
121
|
+
*/
|
|
122
|
+
export declare function createMacro(macro: MacroName, options: unknown): string;
|