@cyberismo/data-handler 0.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +702 -0
- package/dist/card-metadata-updater.d.ts +33 -0
- package/dist/card-metadata-updater.js +121 -0
- package/dist/card-metadata-updater.js.map +1 -0
- package/dist/command-handler.d.ts +96 -0
- package/dist/command-handler.js +557 -0
- package/dist/command-handler.js.map +1 -0
- package/dist/command-manager.d.ts +43 -0
- package/dist/command-manager.js +73 -0
- package/dist/command-manager.js.map +1 -0
- package/dist/commands/calculate.d.ts +86 -0
- package/dist/commands/calculate.js +444 -0
- package/dist/commands/calculate.js.map +1 -0
- package/dist/commands/create.d.ts +114 -0
- package/dist/commands/create.js +389 -0
- package/dist/commands/create.js.map +1 -0
- package/dist/commands/edit.d.ts +37 -0
- package/dist/commands/edit.js +99 -0
- package/dist/commands/edit.js.map +1 -0
- package/dist/commands/export-site.d.ts +45 -0
- package/dist/commands/export-site.js +301 -0
- package/dist/commands/export-site.js.map +1 -0
- package/dist/commands/export.d.ts +53 -0
- package/dist/commands/export.js +251 -0
- package/dist/commands/export.js.map +1 -0
- package/dist/commands/import.d.ts +53 -0
- package/dist/commands/import.js +133 -0
- package/dist/commands/import.js.map +1 -0
- package/dist/commands/index.d.ts +26 -0
- package/dist/commands/index.js +27 -0
- package/dist/commands/index.js.map +1 -0
- package/dist/commands/move.d.ts +55 -0
- package/dist/commands/move.js +341 -0
- package/dist/commands/move.js.map +1 -0
- package/dist/commands/remove.d.ts +38 -0
- package/dist/commands/remove.js +192 -0
- package/dist/commands/remove.js.map +1 -0
- package/dist/commands/rename.d.ts +46 -0
- package/dist/commands/rename.js +289 -0
- package/dist/commands/rename.js.map +1 -0
- package/dist/commands/show.d.ts +124 -0
- package/dist/commands/show.js +345 -0
- package/dist/commands/show.js.map +1 -0
- package/dist/commands/transition.d.ts +27 -0
- package/dist/commands/transition.js +92 -0
- package/dist/commands/transition.js.map +1 -0
- package/dist/commands/update.d.ts +29 -0
- package/dist/commands/update.js +64 -0
- package/dist/commands/update.js.map +1 -0
- package/dist/commands/validate.d.ts +143 -0
- package/dist/commands/validate.js +689 -0
- package/dist/commands/validate.js.map +1 -0
- package/dist/containers/card-container.d.ts +44 -0
- package/dist/containers/card-container.js +282 -0
- package/dist/containers/card-container.js.map +1 -0
- package/dist/containers/project/project-paths.d.ts +46 -0
- package/dist/containers/project/project-paths.js +105 -0
- package/dist/containers/project/project-paths.js.map +1 -0
- package/dist/containers/project/resource-collector.d.ts +86 -0
- package/dist/containers/project/resource-collector.js +331 -0
- package/dist/containers/project/resource-collector.js.map +1 -0
- package/dist/containers/project.d.ts +351 -0
- package/dist/containers/project.js +896 -0
- package/dist/containers/project.js.map +1 -0
- package/dist/containers/template.d.ts +108 -0
- package/dist/containers/template.js +433 -0
- package/dist/containers/template.js.map +1 -0
- package/dist/exceptions/index.d.ts +19 -0
- package/dist/exceptions/index.js +26 -0
- package/dist/exceptions/index.js.map +1 -0
- package/dist/index.d.ts +16 -0
- package/dist/index.js +15 -0
- package/dist/index.js.map +1 -0
- package/dist/interfaces/adoc.d.ts +12 -0
- package/dist/interfaces/adoc.js +13 -0
- package/dist/interfaces/adoc.js.map +1 -0
- package/dist/interfaces/macros.d.ts +45 -0
- package/dist/interfaces/macros.js +13 -0
- package/dist/interfaces/macros.js.map +1 -0
- package/dist/interfaces/project-interfaces.d.ts +121 -0
- package/dist/interfaces/project-interfaces.js +21 -0
- package/dist/interfaces/project-interfaces.js.map +1 -0
- package/dist/interfaces/request-status-interfaces.d.ts +28 -0
- package/dist/interfaces/request-status-interfaces.js +20 -0
- package/dist/interfaces/request-status-interfaces.js.map +1 -0
- package/dist/interfaces/resource-interfaces.d.ts +117 -0
- package/dist/interfaces/resource-interfaces.js +20 -0
- package/dist/interfaces/resource-interfaces.js.map +1 -0
- package/dist/macros/base-macro.d.ts +31 -0
- package/dist/macros/base-macro.js +126 -0
- package/dist/macros/base-macro.js.map +1 -0
- package/dist/macros/common.d.ts +17 -0
- package/dist/macros/common.js +23 -0
- package/dist/macros/common.js.map +1 -0
- package/dist/macros/createCards/index.d.ts +36 -0
- package/dist/macros/createCards/index.js +35 -0
- package/dist/macros/createCards/index.js.map +1 -0
- package/dist/macros/createCards/metadata.d.ts +14 -0
- package/dist/macros/createCards/metadata.js +18 -0
- package/dist/macros/createCards/metadata.js.map +1 -0
- package/dist/macros/graph/index.d.ts +29 -0
- package/dist/macros/graph/index.js +91 -0
- package/dist/macros/graph/index.js.map +1 -0
- package/dist/macros/graph/metadata.d.ts +14 -0
- package/dist/macros/graph/metadata.js +18 -0
- package/dist/macros/graph/metadata.js.map +1 -0
- package/dist/macros/index.d.ts +93 -0
- package/dist/macros/index.js +237 -0
- package/dist/macros/index.js.map +1 -0
- package/dist/macros/report/index.d.ts +26 -0
- package/dist/macros/report/index.js +70 -0
- package/dist/macros/report/index.js.map +1 -0
- package/dist/macros/report/metadata.d.ts +14 -0
- package/dist/macros/report/metadata.js +18 -0
- package/dist/macros/report/metadata.js.map +1 -0
- package/dist/macros/scoreCard/index.d.ts +30 -0
- package/dist/macros/scoreCard/index.js +38 -0
- package/dist/macros/scoreCard/index.js.map +1 -0
- package/dist/macros/scoreCard/metadata.d.ts +14 -0
- package/dist/macros/scoreCard/metadata.js +18 -0
- package/dist/macros/scoreCard/metadata.js.map +1 -0
- package/dist/macros/task-queue.d.ts +46 -0
- package/dist/macros/task-queue.js +69 -0
- package/dist/macros/task-queue.js.map +1 -0
- package/dist/module-manager.d.ts +62 -0
- package/dist/module-manager.js +350 -0
- package/dist/module-manager.js.map +1 -0
- package/dist/permissions/action-guard.d.ts +28 -0
- package/dist/permissions/action-guard.js +61 -0
- package/dist/permissions/action-guard.js.map +1 -0
- package/dist/project-settings.d.ts +42 -0
- package/dist/project-settings.js +120 -0
- package/dist/project-settings.js.map +1 -0
- package/dist/resources/array-handler.d.ts +28 -0
- package/dist/resources/array-handler.js +116 -0
- package/dist/resources/array-handler.js.map +1 -0
- package/dist/resources/card-type-resource.d.ts +72 -0
- package/dist/resources/card-type-resource.js +334 -0
- package/dist/resources/card-type-resource.js.map +1 -0
- package/dist/resources/create-defaults.d.ts +81 -0
- package/dist/resources/create-defaults.js +184 -0
- package/dist/resources/create-defaults.js.map +1 -0
- package/dist/resources/field-type-resource.d.ts +88 -0
- package/dist/resources/field-type-resource.js +411 -0
- package/dist/resources/field-type-resource.js.map +1 -0
- package/dist/resources/file-resource.d.ts +50 -0
- package/dist/resources/file-resource.js +301 -0
- package/dist/resources/file-resource.js.map +1 -0
- package/dist/resources/folder-resource.d.ts +66 -0
- package/dist/resources/folder-resource.js +100 -0
- package/dist/resources/folder-resource.js.map +1 -0
- package/dist/resources/graph-model-resource.d.ts +78 -0
- package/dist/resources/graph-model-resource.js +164 -0
- package/dist/resources/graph-model-resource.js.map +1 -0
- package/dist/resources/graph-view-resource.d.ts +78 -0
- package/dist/resources/graph-view-resource.js +163 -0
- package/dist/resources/graph-view-resource.js.map +1 -0
- package/dist/resources/link-type-resource.d.ts +62 -0
- package/dist/resources/link-type-resource.js +150 -0
- package/dist/resources/link-type-resource.js.map +1 -0
- package/dist/resources/report-resource.d.ts +77 -0
- package/dist/resources/report-resource.js +171 -0
- package/dist/resources/report-resource.js.map +1 -0
- package/dist/resources/resource-object.d.ts +108 -0
- package/dist/resources/resource-object.js +147 -0
- package/dist/resources/resource-object.js.map +1 -0
- package/dist/resources/template-resource.d.ts +82 -0
- package/dist/resources/template-resource.js +173 -0
- package/dist/resources/template-resource.js.map +1 -0
- package/dist/resources/workflow-resource.d.ts +67 -0
- package/dist/resources/workflow-resource.js +156 -0
- package/dist/resources/workflow-resource.js.map +1 -0
- package/dist/types/queries.d.ts +142 -0
- package/dist/types/queries.js +16 -0
- package/dist/types/queries.js.map +1 -0
- package/dist/utils/card-utils.d.ts +34 -0
- package/dist/utils/card-utils.js +78 -0
- package/dist/utils/card-utils.js.map +1 -0
- package/dist/utils/clingo-fact-builder.d.ts +58 -0
- package/dist/utils/clingo-fact-builder.js +126 -0
- package/dist/utils/clingo-fact-builder.js.map +1 -0
- package/dist/utils/clingo-facts.d.ts +97 -0
- package/dist/utils/clingo-facts.js +352 -0
- package/dist/utils/clingo-facts.js.map +1 -0
- package/dist/utils/clingo-parser.d.ts +59 -0
- package/dist/utils/clingo-parser.js +403 -0
- package/dist/utils/clingo-parser.js.map +1 -0
- package/dist/utils/clingo-program-builder.d.ts +39 -0
- package/dist/utils/clingo-program-builder.js +57 -0
- package/dist/utils/clingo-program-builder.js.map +1 -0
- package/dist/utils/common-utils.d.ts +24 -0
- package/dist/utils/common-utils.js +47 -0
- package/dist/utils/common-utils.js.map +1 -0
- package/dist/utils/constants.d.ts +18 -0
- package/dist/utils/constants.js +27 -0
- package/dist/utils/constants.js.map +1 -0
- package/dist/utils/csv.d.ts +18 -0
- package/dist/utils/csv.js +45 -0
- package/dist/utils/csv.js.map +1 -0
- package/dist/utils/file-utils.d.ts +69 -0
- package/dist/utils/file-utils.js +158 -0
- package/dist/utils/file-utils.js.map +1 -0
- package/dist/utils/json.d.ts +61 -0
- package/dist/utils/json.js +108 -0
- package/dist/utils/json.js.map +1 -0
- package/dist/utils/lexorank.d.ts +59 -0
- package/dist/utils/lexorank.js +159 -0
- package/dist/utils/lexorank.js.map +1 -0
- package/dist/utils/log-utils.d.ts +40 -0
- package/dist/utils/log-utils.js +109 -0
- package/dist/utils/log-utils.js.map +1 -0
- package/dist/utils/random.d.ts +19 -0
- package/dist/utils/random.js +34 -0
- package/dist/utils/random.js.map +1 -0
- package/dist/utils/resource-utils.d.ts +45 -0
- package/dist/utils/resource-utils.js +137 -0
- package/dist/utils/resource-utils.js.map +1 -0
- package/dist/utils/sanitize-svg.d.ts +18 -0
- package/dist/utils/sanitize-svg.js +38 -0
- package/dist/utils/sanitize-svg.js.map +1 -0
- package/dist/utils/user-preferences.d.ts +64 -0
- package/dist/utils/user-preferences.js +106 -0
- package/dist/utils/user-preferences.js.map +1 -0
- package/dist/utils/validate.d.ts +26 -0
- package/dist/utils/validate.js +53 -0
- package/dist/utils/validate.js.map +1 -0
- package/dist/utils/value-utils.d.ts +58 -0
- package/dist/utils/value-utils.js +181 -0
- package/dist/utils/value-utils.js.map +1 -0
- package/package.json +67 -0
- package/src/card-metadata-updater.ts +182 -0
- package/src/command-handler.ts +686 -0
- package/src/command-manager.ts +99 -0
- package/src/commands/calculate.ts +591 -0
- package/src/commands/create.ts +559 -0
- package/src/commands/edit.ts +123 -0
- package/src/commands/export-site.ts +356 -0
- package/src/commands/export.ts +315 -0
- package/src/commands/import.ts +169 -0
- package/src/commands/index.ts +42 -0
- package/src/commands/move.ts +451 -0
- package/src/commands/remove.ts +244 -0
- package/src/commands/rename.ts +378 -0
- package/src/commands/show.ts +442 -0
- package/src/commands/transition.ts +127 -0
- package/src/commands/update.ts +76 -0
- package/src/commands/validate.ts +962 -0
- package/src/containers/card-container.ts +378 -0
- package/src/containers/project/project-paths.ts +127 -0
- package/src/containers/project/resource-collector.ts +379 -0
- package/src/containers/project.ts +1135 -0
- package/src/containers/template.ts +573 -0
- package/src/exceptions/index.ts +29 -0
- package/src/index.ts +33 -0
- package/src/interfaces/adoc.ts +18 -0
- package/src/interfaces/macros.ts +54 -0
- package/src/interfaces/project-interfaces.ts +208 -0
- package/src/interfaces/request-status-interfaces.ts +30 -0
- package/src/interfaces/resource-interfaces.ts +179 -0
- package/src/macros/base-macro.ts +176 -0
- package/src/macros/common.ts +24 -0
- package/src/macros/createCards/index.ts +57 -0
- package/src/macros/createCards/metadata.ts +21 -0
- package/src/macros/graph/index.ts +130 -0
- package/src/macros/graph/metadata.ts +21 -0
- package/src/macros/index.ts +321 -0
- package/src/macros/report/index.ts +88 -0
- package/src/macros/report/metadata.ts +21 -0
- package/src/macros/scoreCard/index.ts +55 -0
- package/src/macros/scoreCard/metadata.ts +21 -0
- package/src/macros/task-queue.ts +79 -0
- package/src/module-manager.ts +443 -0
- package/src/permissions/action-guard.ts +77 -0
- package/src/project-settings.ts +140 -0
- package/src/resources/array-handler.ts +141 -0
- package/src/resources/card-type-resource.ts +455 -0
- package/src/resources/create-defaults.ts +216 -0
- package/src/resources/field-type-resource.ts +533 -0
- package/src/resources/file-resource.ts +433 -0
- package/src/resources/folder-resource.ts +140 -0
- package/src/resources/graph-model-resource.ts +205 -0
- package/src/resources/graph-view-resource.ts +199 -0
- package/src/resources/link-type-resource.ts +191 -0
- package/src/resources/report-resource.ts +224 -0
- package/src/resources/resource-object.ts +246 -0
- package/src/resources/template-resource.ts +210 -0
- package/src/resources/workflow-resource.ts +205 -0
- package/src/types/queries.ts +149 -0
- package/src/utils/card-utils.ts +83 -0
- package/src/utils/clingo-fact-builder.ts +167 -0
- package/src/utils/clingo-facts.ts +550 -0
- package/src/utils/clingo-parser.ts +519 -0
- package/src/utils/clingo-program-builder.ts +71 -0
- package/src/utils/common-utils.ts +54 -0
- package/src/utils/constants.ts +32 -0
- package/src/utils/csv.ts +53 -0
- package/src/utils/file-utils.ts +182 -0
- package/src/utils/json.ts +118 -0
- package/src/utils/lexorank.ts +180 -0
- package/src/utils/log-utils.ts +127 -0
- package/src/utils/random.ts +37 -0
- package/src/utils/resource-utils.ts +180 -0
- package/src/utils/sanitize-svg.ts +46 -0
- package/src/utils/user-preferences.ts +126 -0
- package/src/utils/validate.ts +66 -0
- package/src/utils/value-utils.ts +189 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"base-macro.js","sourceRoot":"","sources":["../../src/macros/base-macro.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;EAUE;AAQF,OAAO,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAC1D,OAAO,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAG9C,MAAe,SAAS;IAKV;IACO;IALX,QAAQ,CAAS;IACjB,YAAY,GAAW,CAAC,CAAC;IAEjC,YACY,aAA4B,EACrB,KAAgB;QADvB,kBAAa,GAAb,aAAa,CAAe;QACrB,UAAK,GAAL,KA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,CAAC;QACH,yBAAyB;QACzB,OAAO,WAAW,CAAC;IACrB,CAAC,CAAC;CACH;AAED,eAAe,SAAS,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
Cyberismo
|
|
3
|
+
Copyright © Cyberismo Ltd and contributors 2024
|
|
4
|
+
|
|
5
|
+
This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License version 3 as published by the Free Software Foundation.
|
|
6
|
+
|
|
7
|
+
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.
|
|
8
|
+
|
|
9
|
+
You should have received a copy of the GNU Affero General Public
|
|
10
|
+
License along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
11
|
+
*/
|
|
12
|
+
export declare const macroMetadata: {
|
|
13
|
+
createCards: import("../interfaces/macros.js").MacroMetadata;
|
|
14
|
+
graph: import("../interfaces/macros.js").MacroMetadata;
|
|
15
|
+
report: import("../interfaces/macros.js").MacroMetadata;
|
|
16
|
+
scoreCard: import("../interfaces/macros.js").MacroMetadata;
|
|
17
|
+
};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
Cyberismo
|
|
3
|
+
Copyright © Cyberismo Ltd and contributors 2024
|
|
4
|
+
|
|
5
|
+
This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License version 3 as published by the Free Software Foundation.
|
|
6
|
+
|
|
7
|
+
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.
|
|
8
|
+
|
|
9
|
+
You should have received a copy of the GNU Affero General Public
|
|
10
|
+
License along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
11
|
+
*/
|
|
12
|
+
// important that this file imports only the metadata
|
|
13
|
+
import createCards from './createCards/metadata.js';
|
|
14
|
+
import graph from './graph/metadata.js';
|
|
15
|
+
import report from './report/metadata.js';
|
|
16
|
+
import scoreCard from './scoreCard/metadata.js';
|
|
17
|
+
export const macroMetadata = {
|
|
18
|
+
createCards,
|
|
19
|
+
graph,
|
|
20
|
+
report,
|
|
21
|
+
scoreCard,
|
|
22
|
+
};
|
|
23
|
+
//# sourceMappingURL=common.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"common.js","sourceRoot":"","sources":["../../src/macros/common.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;EAUE;AAEF,qDAAqD;AACrD,OAAO,WAAW,MAAM,2BAA2B,CAAC;AACpD,OAAO,KAAK,MAAM,qBAAqB,CAAC;AACxC,OAAO,MAAM,MAAM,sBAAsB,CAAC;AAC1C,OAAO,SAAS,MAAM,yBAAyB,CAAC;AAEhD,MAAM,CAAC,MAAM,aAAa,GAAG;IAC3B,WAAW;IACX,KAAK;IACL,MAAM;IACN,SAAS;CACV,CAAC"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
Cyberismo
|
|
3
|
+
Copyright © Cyberismo Ltd and contributors 2024
|
|
4
|
+
|
|
5
|
+
This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License version 3 as published by the Free Software Foundation.
|
|
6
|
+
|
|
7
|
+
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.
|
|
8
|
+
|
|
9
|
+
You should have received a copy of the GNU Affero General Public
|
|
10
|
+
License along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
11
|
+
*/
|
|
12
|
+
import type { MacroOptions } from '../index.js';
|
|
13
|
+
import type { MacroGenerationContext } from '../../interfaces/macros.js';
|
|
14
|
+
import BaseMacro from '../base-macro.js';
|
|
15
|
+
import type TaskQueue from '../task-queue.js';
|
|
16
|
+
export interface CreateCardsOptions extends MacroOptions {
|
|
17
|
+
buttonLabel: string;
|
|
18
|
+
template: string;
|
|
19
|
+
cardKey?: string;
|
|
20
|
+
link?: {
|
|
21
|
+
linkType: string;
|
|
22
|
+
direction: string;
|
|
23
|
+
cardKey: string;
|
|
24
|
+
};
|
|
25
|
+
[key: string]: string | undefined | {
|
|
26
|
+
[key: string]: string | undefined;
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
declare class CreateCardsMacro extends BaseMacro {
|
|
30
|
+
constructor(tasksQueue: TaskQueue);
|
|
31
|
+
handleValidate: (input: unknown) => void;
|
|
32
|
+
handleStatic(): Promise<string>;
|
|
33
|
+
handleInject: (_: MacroGenerationContext, input: unknown) => Promise<string>;
|
|
34
|
+
private validate;
|
|
35
|
+
}
|
|
36
|
+
export default CreateCardsMacro;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
Cyberismo
|
|
3
|
+
Copyright © Cyberismo Ltd and contributors 2024
|
|
4
|
+
|
|
5
|
+
This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License version 3 as published by the Free Software Foundation.
|
|
6
|
+
|
|
7
|
+
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.
|
|
8
|
+
|
|
9
|
+
You should have received a copy of the GNU Affero General Public
|
|
10
|
+
License along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
11
|
+
*/
|
|
12
|
+
import { createHtmlPlaceholder, validateMacroContent } from '../index.js';
|
|
13
|
+
import macroMetadata from './metadata.js';
|
|
14
|
+
import BaseMacro from '../base-macro.js';
|
|
15
|
+
class CreateCardsMacro extends BaseMacro {
|
|
16
|
+
constructor(tasksQueue) {
|
|
17
|
+
super(macroMetadata, tasksQueue);
|
|
18
|
+
}
|
|
19
|
+
handleValidate = (input) => {
|
|
20
|
+
this.validate(input);
|
|
21
|
+
};
|
|
22
|
+
async handleStatic() {
|
|
23
|
+
// Buttons aren't supported in static mode
|
|
24
|
+
return '';
|
|
25
|
+
}
|
|
26
|
+
handleInject = async (_, input) => {
|
|
27
|
+
const options = this.validate(input);
|
|
28
|
+
return createHtmlPlaceholder(this.metadata, options);
|
|
29
|
+
};
|
|
30
|
+
validate(input) {
|
|
31
|
+
return validateMacroContent(this.metadata, input);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
export default CreateCardsMacro;
|
|
35
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/macros/createCards/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;EAUE;AAGF,OAAO,EAAE,qBAAqB,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAG1E,OAAO,aAAa,MAAM,eAAe,CAAC;AAC1C,OAAO,SAAS,MAAM,kBAAkB,CAAC;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;IAEM,QAAQ,CAAC,KAAc;QAC7B,OAAO,oBAAoB,CAAqB,IAAI,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC;IACxE,CAAC;CACF;AAED,eAAe,gBAAgB,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
Cyberismo
|
|
3
|
+
Copyright © Cyberismo Ltd and contributors 2024
|
|
4
|
+
|
|
5
|
+
This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License version 3 as published by the Free Software Foundation.
|
|
6
|
+
|
|
7
|
+
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.
|
|
8
|
+
|
|
9
|
+
You should have received a copy of the GNU Affero General Public
|
|
10
|
+
License along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
11
|
+
*/
|
|
12
|
+
import type { MacroMetadata } from '../../interfaces/macros.js';
|
|
13
|
+
declare const macroMetadata: MacroMetadata;
|
|
14
|
+
export default macroMetadata;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
Cyberismo
|
|
3
|
+
Copyright © Cyberismo Ltd and contributors 2024
|
|
4
|
+
|
|
5
|
+
This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License version 3 as published by the Free Software Foundation.
|
|
6
|
+
|
|
7
|
+
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.
|
|
8
|
+
|
|
9
|
+
You should have received a copy of the GNU Affero General Public
|
|
10
|
+
License along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
11
|
+
*/
|
|
12
|
+
const macroMetadata = {
|
|
13
|
+
name: 'createCards',
|
|
14
|
+
tagName: 'create-cards',
|
|
15
|
+
schema: 'createCardsMacroSchema',
|
|
16
|
+
};
|
|
17
|
+
export default macroMetadata;
|
|
18
|
+
//# sourceMappingURL=metadata.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"metadata.js","sourceRoot":"","sources":["../../../src/macros/createCards/metadata.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;EAUE;AAIF,MAAM,aAAa,GAAkB;IACnC,IAAI,EAAE,aAAa;IACnB,OAAO,EAAE,cAAc;IACvB,MAAM,EAAE,wBAAwB;CACjC,CAAC;AAEF,eAAe,aAAa,CAAC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
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 BaseMacro from '../base-macro.js';
|
|
15
|
+
import type { MacroOptions } from '../index.js';
|
|
16
|
+
import type { MacroGenerationContext } from '../../interfaces/macros.js';
|
|
17
|
+
import type TaskQueue from '../task-queue.js';
|
|
18
|
+
export interface GraphOptions extends MacroOptions {
|
|
19
|
+
model: string;
|
|
20
|
+
view: string;
|
|
21
|
+
}
|
|
22
|
+
declare class ReportMacro extends BaseMacro {
|
|
23
|
+
constructor(tasksQueue: TaskQueue);
|
|
24
|
+
handleValidate: (input: unknown) => void;
|
|
25
|
+
handleStatic: (context: MacroGenerationContext, input: unknown) => Promise<string>;
|
|
26
|
+
handleInject: (context: MacroGenerationContext, input: unknown) => Promise<string>;
|
|
27
|
+
private parseOptions;
|
|
28
|
+
}
|
|
29
|
+
export default ReportMacro;
|
|
@@ -0,0 +1,91 @@
|
|
|
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 BaseMacro from '../base-macro.js';
|
|
15
|
+
import { Calculate } from '../../commands/index.js';
|
|
16
|
+
import { createImage, validateMacroContent } from '../index.js';
|
|
17
|
+
import Handlebars from 'handlebars';
|
|
18
|
+
import { join } from 'node:path';
|
|
19
|
+
import { logger } from '../../utils/log-utils.js';
|
|
20
|
+
import macroMetadata from './metadata.js';
|
|
21
|
+
import { pathExists } from '../../utils/file-utils.js';
|
|
22
|
+
import { Project } from '../../containers/project.js';
|
|
23
|
+
import { readFile } from 'node:fs/promises';
|
|
24
|
+
import { resourceName } from '../../utils/resource-utils.js';
|
|
25
|
+
import { validateJson } from '../../utils/validate.js';
|
|
26
|
+
class ReportMacro extends BaseMacro {
|
|
27
|
+
constructor(tasksQueue) {
|
|
28
|
+
super(macroMetadata, tasksQueue);
|
|
29
|
+
}
|
|
30
|
+
handleValidate = (input) => {
|
|
31
|
+
this.parseOptions(input);
|
|
32
|
+
};
|
|
33
|
+
handleStatic = async (context, input) => {
|
|
34
|
+
return this.handleInject(context, input);
|
|
35
|
+
};
|
|
36
|
+
handleInject = async (context, input) => {
|
|
37
|
+
const project = new Project(context.projectPath);
|
|
38
|
+
const calculate = new Calculate(project);
|
|
39
|
+
const resourceNameToPath = (name, fileName) => {
|
|
40
|
+
const { identifier, prefix, type } = resourceName(name);
|
|
41
|
+
if (prefix === project.projectPrefix) {
|
|
42
|
+
return join(project.paths.resourcesFolder, type, identifier, fileName);
|
|
43
|
+
}
|
|
44
|
+
return join(project.paths.modulesFolder, prefix, type, identifier, fileName);
|
|
45
|
+
};
|
|
46
|
+
const options = this.parseOptions(input);
|
|
47
|
+
let schema = null;
|
|
48
|
+
try {
|
|
49
|
+
schema = JSON.parse(await readFile(resourceNameToPath(options.view, 'parameterSchema.json'), { encoding: 'utf-8' }));
|
|
50
|
+
}
|
|
51
|
+
catch (err) {
|
|
52
|
+
logger.trace(err, 'Graph schema not found or failed to read, skipping validation');
|
|
53
|
+
}
|
|
54
|
+
if (schema) {
|
|
55
|
+
validateJson(options, {
|
|
56
|
+
schema,
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
const modelLocation = resourceNameToPath(options.model, 'model.lp');
|
|
60
|
+
const viewLocation = resourceNameToPath(options.view, 'view.lp.hbs');
|
|
61
|
+
if (!pathExists(modelLocation)) {
|
|
62
|
+
throw new Error(`Graph: Model ${options.model} does not exist`);
|
|
63
|
+
}
|
|
64
|
+
let viewContent = '';
|
|
65
|
+
try {
|
|
66
|
+
viewContent = await readFile(viewLocation, { encoding: 'utf-8' });
|
|
67
|
+
}
|
|
68
|
+
catch {
|
|
69
|
+
throw new Error(`Graph: View ${options.view} does not exist`);
|
|
70
|
+
}
|
|
71
|
+
const handlebarsContext = {
|
|
72
|
+
cardKey: context.cardKey,
|
|
73
|
+
...options,
|
|
74
|
+
};
|
|
75
|
+
const handlebars = Handlebars.create();
|
|
76
|
+
const view = handlebars.compile(viewContent)(handlebarsContext);
|
|
77
|
+
const modelContent = await readFile(modelLocation, { encoding: 'utf-8' });
|
|
78
|
+
const result = await calculate.runGraph({
|
|
79
|
+
query: view + '\n' + modelContent,
|
|
80
|
+
});
|
|
81
|
+
if (typeof result !== 'string') {
|
|
82
|
+
throw new Error('Graph macro expected a string from clingo, but received an object');
|
|
83
|
+
}
|
|
84
|
+
return createImage(result);
|
|
85
|
+
};
|
|
86
|
+
parseOptions(input) {
|
|
87
|
+
return validateMacroContent(this.metadata, input);
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
export default ReportMacro;
|
|
91
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/macros/graph/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;EAYE;AAEF,OAAO,SAAS,MAAM,kBAAkB,CAAC;AACzC,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AAEpD,OAAO,EAAE,WAAW,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAChE,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,MAAM,EAAE,MAAM,0BAA0B,CAAC;AAElD,OAAO,aAAa,MAAM,eAAe,CAAC;AAC1C,OAAO,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AACvD,OAAO,EAAE,OAAO,EAAE,MAAM,6BAA6B,CAAC;AACtD,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAE7D,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAQvD,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,OAAO,IAAI,CAAC,YAAY,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;IAC3C,CAAC,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AAe,WAAW,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
Cyberismo
|
|
3
|
+
Copyright © Cyberismo Ltd and contributors 2024
|
|
4
|
+
|
|
5
|
+
This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License version 3 as published by the Free Software Foundation.
|
|
6
|
+
|
|
7
|
+
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.
|
|
8
|
+
|
|
9
|
+
You should have received a copy of the GNU Affero General Public
|
|
10
|
+
License along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
11
|
+
*/
|
|
12
|
+
import type { MacroMetadata } from '../../interfaces/macros.js';
|
|
13
|
+
declare const macroMetadata: MacroMetadata;
|
|
14
|
+
export default macroMetadata;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
Cyberismo
|
|
3
|
+
Copyright © Cyberismo Ltd and contributors 2024
|
|
4
|
+
|
|
5
|
+
This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License version 3 as published by the Free Software Foundation.
|
|
6
|
+
|
|
7
|
+
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.
|
|
8
|
+
|
|
9
|
+
You should have received a copy of the GNU Affero General Public
|
|
10
|
+
License along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
11
|
+
*/
|
|
12
|
+
const macroMetadata = {
|
|
13
|
+
name: 'graph',
|
|
14
|
+
tagName: 'graph',
|
|
15
|
+
schema: 'graphMacroBaseSchema',
|
|
16
|
+
};
|
|
17
|
+
export default macroMetadata;
|
|
18
|
+
//# sourceMappingURL=metadata.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"metadata.js","sourceRoot":"","sources":["../../../src/macros/graph/metadata.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;EAUE;AAIF,MAAM,aAAa,GAAkB;IACnC,IAAI,EAAE,OAAO;IACb,OAAO,EAAE,OAAO;IAChB,MAAM,EAAE,sBAAsB;CAC/B,CAAC;AAEF,eAAe,aAAa,CAAC"}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
/**
|
|
2
|
+
Cyberismo
|
|
3
|
+
Copyright © Cyberismo Ltd and contributors 2024
|
|
4
|
+
|
|
5
|
+
This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License version 3 as published by the Free Software Foundation.
|
|
6
|
+
|
|
7
|
+
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.
|
|
8
|
+
|
|
9
|
+
You should have received a copy of the GNU Affero General Public
|
|
10
|
+
License along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
11
|
+
*/
|
|
12
|
+
import Handlebars from 'handlebars';
|
|
13
|
+
import type { AdmonitionType } from '../interfaces/adoc.js';
|
|
14
|
+
import type { Validator } from 'jsonschema';
|
|
15
|
+
import type { MacroGenerationContext, MacroMetadata, MacroName } from '../interfaces/macros.js';
|
|
16
|
+
import type BaseMacro from './base-macro.js';
|
|
17
|
+
import TaskQueue from './task-queue.js';
|
|
18
|
+
export interface MacroConstructor {
|
|
19
|
+
new (tasks: TaskQueue): BaseMacro;
|
|
20
|
+
}
|
|
21
|
+
export declare const macros: {
|
|
22
|
+
[K in MacroName]: MacroConstructor;
|
|
23
|
+
};
|
|
24
|
+
export declare function validateMacroContent<T>(macro: MacroMetadata, data: unknown, validator?: Validator): T;
|
|
25
|
+
/**
|
|
26
|
+
* Registers the macros with Handlebars
|
|
27
|
+
* @param {Mode} mode - The mode to register the macros in
|
|
28
|
+
*/
|
|
29
|
+
export declare function registerMacros(instance: typeof Handlebars, context: MacroGenerationContext, tasks: TaskQueue): BaseMacro[];
|
|
30
|
+
/**
|
|
31
|
+
* Calculate amount of handlebars templates inside a string
|
|
32
|
+
* @param input
|
|
33
|
+
*/
|
|
34
|
+
export declare function macroCount(input: string): number;
|
|
35
|
+
/**
|
|
36
|
+
* Registers macros as handlebars helpers, which just leaves the macros in the content
|
|
37
|
+
* Can be used when your macro uses handlebars and handles content that might contain macros
|
|
38
|
+
* The handleMacros function will handle recursive macros so do not execute them inside your macro
|
|
39
|
+
* @param instance handlebars instance
|
|
40
|
+
*/
|
|
41
|
+
export declare function registerEmptyMacros(instance: typeof Handlebars): void;
|
|
42
|
+
/**
|
|
43
|
+
* Handle the macros in the content
|
|
44
|
+
* @param content - The content to handle the macros in
|
|
45
|
+
* @param mode - The mode to handle the macros in. Inject mode will generate injectable placeholders for the macros while static mode will generate valid adoc. Validate mode will only validate the macros syntax and throw errors in case of issues.
|
|
46
|
+
*/
|
|
47
|
+
export declare function evaluateMacros(content: string, context: MacroGenerationContext, maxTries?: number): Promise<string>;
|
|
48
|
+
/**
|
|
49
|
+
* This function assumes that tasks, which were started by macros, are complete.
|
|
50
|
+
* It replaces the placeholders of the tasks with the actual results
|
|
51
|
+
* @param input Adoc content, which might have macro placeholders
|
|
52
|
+
* @param tasks The taskqueue, which was used to run the macros
|
|
53
|
+
* @param context General context for the macro evaluation process
|
|
54
|
+
* @returns Adoc, where placeholders have been replaced with the results.
|
|
55
|
+
* Note that the results might include new macros.
|
|
56
|
+
*/
|
|
57
|
+
export declare function applyMacroResults(input: string, tasks: TaskQueue, context: MacroGenerationContext): string;
|
|
58
|
+
/**
|
|
59
|
+
* Handles errors that come when handling macros
|
|
60
|
+
* @param error - The error that was thrown
|
|
61
|
+
* @param macro - The macro that caused the error
|
|
62
|
+
* @returns The error message that is valid adoc
|
|
63
|
+
*/
|
|
64
|
+
export declare function handleMacroError(error: unknown, macro: string, context: MacroGenerationContext): string;
|
|
65
|
+
type Value = string | number | boolean | undefined;
|
|
66
|
+
/**
|
|
67
|
+
* Macro options can be a flat object or a nested object
|
|
68
|
+
* The nested object will be flattened into dot notation attributes
|
|
69
|
+
*/
|
|
70
|
+
export type MacroOptions = {
|
|
71
|
+
[key: string]: Value | MacroOptions;
|
|
72
|
+
};
|
|
73
|
+
/**
|
|
74
|
+
* Creates an injectable placeholder for a macro
|
|
75
|
+
* @param macro - The macro to create the placeholder for
|
|
76
|
+
* @param options - Options will be passed to the html element as attributes
|
|
77
|
+
*/
|
|
78
|
+
export declare function createHtmlPlaceholder(macro: MacroMetadata, options: MacroOptions): string;
|
|
79
|
+
/**
|
|
80
|
+
* Creates an adoc admonition
|
|
81
|
+
* @param type - The type of admonition
|
|
82
|
+
* @param label - The label of the admonition
|
|
83
|
+
* @param content - The content of the admonition
|
|
84
|
+
* @returns The adoc admonition as a string
|
|
85
|
+
*/
|
|
86
|
+
export declare function createAdmonition(type: AdmonitionType, label: string, content: string): string;
|
|
87
|
+
/**
|
|
88
|
+
* Helper function for including base64 encoded images for now
|
|
89
|
+
* @param image base64 encoded image
|
|
90
|
+
* @returns valid asciidoc with the image
|
|
91
|
+
*/
|
|
92
|
+
export declare function createImage(image: string): string;
|
|
93
|
+
export {};
|