@cyberismo/assets 0.0.23 → 0.0.24

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/schemas.d.ts CHANGED
@@ -222,7 +222,7 @@ export declare const schemas: ({
222
222
  properties: {
223
223
  name: {
224
224
  description: string;
225
- type: string;
225
+ $ref: string;
226
226
  };
227
227
  displayName: {
228
228
  description: string;
@@ -240,10 +240,6 @@ export declare const schemas: ({
240
240
  description: string;
241
241
  type: string;
242
242
  };
243
- branch: {
244
- description: string;
245
- type: string;
246
- };
247
243
  private: {
248
244
  description: string;
249
245
  type: string;
@@ -256,6 +252,18 @@ export declare const schemas: ({
256
252
  required: string[];
257
253
  title: string;
258
254
  type: string;
255
+ } | {
256
+ $id: string;
257
+ $schema: string;
258
+ additionalProperties: boolean;
259
+ properties: {
260
+ code: {
261
+ type: string;
262
+ description: string;
263
+ };
264
+ };
265
+ required: string[];
266
+ type: string;
259
267
  } | {
260
268
  $id: string;
261
269
  additionalProperties: boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cyberismo/assets",
3
- "version": "0.0.23",
3
+ "version": "0.0.24",
4
4
  "description": "This package contains static resources",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -15,7 +15,7 @@
15
15
  "bugs": "https://github.com/CyberismoCom/cyberismo/issues",
16
16
  "type": "module",
17
17
  "devDependencies": {
18
- "esbuild": "^0.27.2",
18
+ "esbuild": "^0.28.0",
19
19
  "esbuild-plugin-import-glob": "^0.1.1"
20
20
  },
21
21
  "files": [
@@ -4,13 +4,13 @@
4
4
  :toc: macro
5
5
  :numbered:
6
6
  :imagesdir: images
7
- :revnumber: {{version}}
8
- :revdate: {{date}}
9
- :revremark: {{revremark}}
10
- :!chapter-signifier:
7
+ {{#if version}}:revnumber: {{version}}
8
+ {{/if}}{{#if date}}:revdate: {{date}}
9
+ {{/if}}{{#if revremark}}:revremark: {{revremark}}
10
+ {{/if}}:!chapter-signifier:
11
11
  :source-highlighter: rouge
12
12
  :toclevels: 5
13
- +
13
+
14
14
  toc::[]
15
15
  {{#each results}}
16
16
  {{#include}}
package/src/index.ts CHANGED
@@ -12,10 +12,12 @@ import queriesConnectors from './calculations/queries/connectors.lp';
12
12
  import queriesTree from './calculations/queries/tree.lp';
13
13
  import testModel from './calculations/test/model.lp';
14
14
 
15
- import pdfReportIndex from './exportPdfReport/index.adoc.hbs';
16
- import pdfReportQuery from './exportPdfReport/query.lp.hbs';
17
- import graphvizReportIndex from './graphvizReport/index.adoc.hbs';
18
- import graphvizReportQuery from './graphvizReport/query.lp.hbs';
15
+ import pdfReportIndex from './exportPdfReport/index.adoc.hbs' with { type: 'text' };
16
+ import pdfReportQuery from './exportPdfReport/query.lp.hbs' with { type: 'text' };
17
+ import graphvizReportIndex from './graphvizReport/index.adoc.hbs' with { type: 'text' };
18
+ import graphvizReportQuery from './graphvizReport/query.lp.hbs' with { type: 'text' };
19
+ import workflowGraphModel from './workflowGraph/model.lp' with { type: 'text' };
20
+ import workflowGraphView from './workflowGraph/view.lp.hbs' with { type: 'text' };
19
21
 
20
22
  export const graphvizReport = {
21
23
  query: graphvizReportQuery,
@@ -27,6 +29,11 @@ export const pdfReport = {
27
29
  content: pdfReportIndex,
28
30
  };
29
31
 
32
+ export const workflowGraph = {
33
+ model: workflowGraphModel,
34
+ view: workflowGraphView,
35
+ };
36
+
30
37
  export const lpFiles = {
31
38
  common: {
32
39
  base: commonBase,
@@ -1,4 +1,13 @@
1
1
  {
2
+ "$defs": {
3
+ "projectPrefix": {
4
+ "type": "string",
5
+ "description": "Project prefix: 3–10 lowercase letters.",
6
+ "pattern": "^[a-z]+$",
7
+ "minLength": 3,
8
+ "maxLength": 10
9
+ }
10
+ },
2
11
  "$id": "cardsConfigSchema",
3
12
  "additionalProperties": false,
4
13
  "description": "General configuration settings for the card tree.",
@@ -8,11 +17,8 @@
8
17
  "description": "Project schema version"
9
18
  },
10
19
  "cardKeyPrefix": {
11
- "type": "string",
12
20
  "description": "The prefix or the fist component of the card key. For example, ABC",
13
- "pattern": "^[a-z]+$",
14
- "minLength": 3,
15
- "maxLength": 10
21
+ "$ref": "#/$defs/projectPrefix"
16
22
  },
17
23
  "name": {
18
24
  "description": "Project name",
@@ -53,19 +59,19 @@
53
59
  "properties": {
54
60
  "name": {
55
61
  "description": "Module name (project prefix). Must be unique.",
56
- "type": "string"
62
+ "$ref": "#/$defs/projectPrefix"
57
63
  },
58
64
  "location": {
59
65
  "description": "Git remote URL, or relative file reference.",
60
66
  "type": "string"
61
67
  },
62
- "branch": {
63
- "description": "If using git remote URL in 'location' defines git branch. If empty, uses repository default branch'.",
64
- "type": "string"
65
- },
66
68
  "private": {
67
69
  "description": "If true, the module is private and requires credentials (CYBERISMO_GIT_USER / CYBERISMO_GIT_TOKEN) or SSH. Does not apply for local file modules.",
68
70
  "type": "boolean"
71
+ },
72
+ "version": {
73
+ "description": "Semver version or range constraint (e.g., '1.0.0', '^1.0.0', '>=1.2.0 <2.0.0'). When omitted, any version is accepted.",
74
+ "type": "string"
69
75
  }
70
76
  },
71
77
  "required": ["name", "location"]
@@ -26,7 +26,7 @@
26
26
  "properties": {
27
27
  "name": {
28
28
  "description": "Module name (project prefix). Must be unique globally.",
29
- "type": "string"
29
+ "$ref": "cardsConfigSchema#/$defs/projectPrefix"
30
30
  },
31
31
  "displayName": {
32
32
  "description": "Display name of the module",
@@ -44,10 +44,6 @@
44
44
  "description": "URI to the documentation of the module",
45
45
  "type": "string"
46
46
  },
47
- "branch": {
48
- "description": "If using git remote URL in 'location' defines git branch. If empty, uses repository default branch'.",
49
- "type": "string"
50
- },
51
47
  "private": {
52
48
  "description": "If true, the module is private and requires credentials (CYBERISMO_GIT_USER / CYBERISMO_GIT_TOKEN) or SSH. Does not apply for local file modules.",
53
49
  "type": "boolean"
@@ -0,0 +1,13 @@
1
+ {
2
+ "$id": "mermaidMacroSchema",
3
+ "$schema": "http://json-schema.org/draft-07/schema#",
4
+ "additionalProperties": false,
5
+ "properties": {
6
+ "code": {
7
+ "type": "string",
8
+ "description": "Mermaid diagram definition text"
9
+ }
10
+ },
11
+ "required": ["code"],
12
+ "type": "object"
13
+ }
@@ -1,3 +1,3 @@
1
1
  {
2
- "schemaVersion": 3
2
+ "schemaVersion": 4
3
3
  }
package/src/schemas.ts CHANGED
@@ -27,6 +27,7 @@ import hubSchema from './schema/hubSchema.json' with { type: 'json' };
27
27
  import imageMacroSchema from './schema/macros/imageMacroSchema.json' with { type: 'json' };
28
28
  import includeMacroSchema from './schema/macros/includeMacroSchema.json' with { type: 'json' };
29
29
  import linkTypeSchema from './schema/resources/linkTypeSchema.json' with { type: 'json' };
30
+ import mermaidMacroSchema from './schema/macros/mermaidMacroSchema.json' with { type: 'json' };
30
31
  import percentageMacroSchema from './schema/macros/percentageMacroSchema.json' with { type: 'json' };
31
32
  import reportMacroBaseSchema from './schema/macros/reportMacroBaseSchema.json' with { type: 'json' };
32
33
  import reportSchema from './schema/resources/reportSchema.json' with { type: 'json' };
@@ -58,6 +59,7 @@ export const schemas = [
58
59
  imageMacroSchema,
59
60
  includeMacroSchema,
60
61
  linkTypeSchema,
62
+ mermaidMacroSchema,
61
63
  percentageMacroSchema,
62
64
  reportMacroBaseSchema,
63
65
  reportSchema,
@@ -0,0 +1,86 @@
1
+ graph(toplevelGraph).
2
+ attr(graph, toplevelGraph, rankdir, "TD").
3
+
4
+ % the "initial node" from where the card is created
5
+ node("", toplevelGraph) :- workflowState(Workflow, State, _), visible(Workflow).
6
+
7
+ % Let's add a separate "Any state" for every state that has transitions from "*"
8
+ node(("*", To), toplevelGraph) :-
9
+ workflowTransition(Workflow, _, "*", To),
10
+ visible(Workflow).
11
+
12
+ attr(node, ("*", To), label, @concatenate("<<font point-size='11'> Any state </font>>")) :-
13
+ workflowTransition(Workflow, _, "*", To),
14
+ visible(Workflow).
15
+
16
+ node(State, toplevelGraph) :- workflowState(Workflow, State, _), visible(Workflow).
17
+
18
+ % Regular state label
19
+ attr(node, State, label, @concatenate("<<font point-size='14'> <b>", State, "</b> </font> <br/> <font point-size='10'>", StateCategory, "</font>>")) :-
20
+ workflowState(Workflow, State, StateCategory),
21
+ visible(Workflow),
22
+ not currentState(State),
23
+ State != "",
24
+ State != "*".
25
+
26
+ % Current state label is rendered larger and underlined to stand out
27
+ attr(node, State, label, @concatenate("<<font point-size='16'> <b><u>", State, "</u></b> </font> <br/> <font point-size='10'>", StateCategory, "</font>>")) :-
28
+ workflowState(Workflow, State, StateCategory),
29
+ visible(Workflow),
30
+ currentState(State),
31
+ State != "",
32
+ State != "*".
33
+
34
+ edge((From, To, Transition), toplevelGraph) :-
35
+ workflowTransition(Workflow, Transition, From, To),
36
+ visible(Workflow),
37
+ From != "*".
38
+
39
+ attr(edge, (From, To, Transition), label, @concatenate("<<font point-size='10'>", Transition, "</font>>")) :-
40
+ workflowTransition(Workflow, Transition, From, To),
41
+ visible(Workflow),
42
+ From != "*".
43
+
44
+ edge((("*", To), To, Transition), toplevelGraph) :-
45
+ workflowTransition(Workflow, Transition, "*", To),
46
+ visible(Workflow).
47
+
48
+ attr(edge, (("*", To), To, Transition), label, @concatenate("<<font point-size='10'>", Transition, "</font>>")) :-
49
+ workflowTransition(Workflow, Transition, "*", To),
50
+ visible(Workflow).
51
+
52
+ % margins
53
+ attr(graph, toplevelGraph, pad, "0.1").
54
+ attr(graph, toplevelGraph, nodesep, "0.6").
55
+ attr(graph, toplevelGraph, ranksep, "0.7").
56
+ attr(node, X, margin, "0.15") :- node(X, _).
57
+ attr(graph, X, margin, "8") :- graph(X, _).
58
+
59
+ % penwidth
60
+ attr(graph, X, penwidth, "1") :- graph(X).
61
+ attr(graph, X, penwidth, "1") :- graph(X, _).
62
+ attr(node, X, penwidth, "1") :- node(X, _), X != "", not currentState(X).
63
+ attr(node, X, penwidth, "3") :- node(X, _), currentState(X).
64
+ attr(node, X, penwidth, "2") :- node(X, _), X = "".
65
+ attr(edge, (X, Y, N), penwidth, "1") :- edge((X, Y, N), _).
66
+ attr(edge, (X, Y, N), arrowsize, "0.8") :- edge((X, Y, N), _).
67
+
68
+ % shapes of nodes
69
+ attr(node, X, shape, rectangle) :- node(X, _), X != "".
70
+ attr(node, X, shape, circle) :- node(X, _), X = "".
71
+ attr(node, X, style, rounded) :- node(X, _).
72
+
73
+ % node colours
74
+ attr(node, State, color, "#FF9300") :-
75
+ workflowState(Workflow, State, "active"),
76
+ visible(Workflow).
77
+
78
+ attr(node, State, color, "#37E900") :-
79
+ workflowState(Workflow, State, "closed"),
80
+ visible(Workflow).
81
+
82
+ % fonts
83
+ attr(graph, G, fontname, "helvetica") :- graph(G).
84
+ attr(graph, G, fontname, "helvetica") :- graph(G, _).
85
+ attr(node, N, fontname, "helvetica") :- node(N, _).
86
+ attr(edge, (X, Y, N), fontname, "helvetica") :- edge((X, Y, N), _).
@@ -0,0 +1,4 @@
1
+ visible("{{{clingoEscape workflow}}}").
2
+ {{#if currentState}}
3
+ currentState("{{{clingoEscape currentState}}}").
4
+ {{/if}}