@cyberismo/assets 0.0.23 → 0.0.25

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.25",
4
4
  "description": "This package contains static resources",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -13,9 +13,12 @@
13
13
  "url": "git+https://github.com/CyberismoCom/cyberismo.git"
14
14
  },
15
15
  "bugs": "https://github.com/CyberismoCom/cyberismo/issues",
16
+ "engines": {
17
+ "node": ">=22"
18
+ },
16
19
  "type": "module",
17
20
  "devDependencies": {
18
- "esbuild": "^0.27.2",
21
+ "esbuild": "^0.28.0",
19
22
  "esbuild-plugin-import-glob": "^0.1.1"
20
23
  },
21
24
  "files": [
@@ -82,11 +82,6 @@ resultField(Key, Field, Value, DataType) :-
82
82
  % "field" of result/child result "key" has value "value",
83
83
  % data type of the field is included, if not specified, it is shortText
84
84
  % a field term like this is returned for all other fields except enum and list
85
- %
86
- % enumField(key, field, value, index, enum display value):
87
- % listField(key, field, value, index, enum display value):
88
- % otherwise the same as field, but for enum and list fields,
89
- % we also need the enum value index and enum display value
90
85
 
91
86
  #show field(Key, Field, Value, DataType) :
92
87
  field(Key, Field, Value),
@@ -106,94 +101,49 @@ resultField(Key, Field, Value, DataType) :-
106
101
  showField(Key, Field).
107
102
 
108
103
  % list
109
- childResult(Key, (Key, Field, Value), Field) :-
110
- DataType = "list",
111
- resultField(Key, Field, Value, DataType).
112
-
113
- resultField((Key, Field, Value), "value", Value, "shortText") :-
114
- childResult(Key, (Key, Field, Value), Field),
115
- resultField(Key, Field, Value, _).
116
-
117
- resultField((Key, Field, Value), "index", Index, "integer") :-
118
- childResult(Key, (Key, Field, Value), Field),
119
- resultField(Key, Field, Value, _),
120
- field((Field, Value), "index", Index).
121
-
122
- resultField((Key, Field, Value), "displayName", EnumDisplayValue, "shortText") :-
123
- childResult(Key, (Key, Field, Value), Field),
124
- resultField(Key, Field, Value, _),
125
- field((Field, Value), "enumDisplayValue", EnumDisplayValue).
104
+ listField(Key, Field, Value) :-
105
+ resultField(Key, Field, Value, "list").
126
106
 
127
- childResult(Key, (Key, Field, Value), Field) :-
107
+ listField(Key, Field, Value) :-
128
108
  field(Key, Field, Value),
129
109
  dataType(Key, Field, "list"),
130
110
  showField(Key, Field).
131
111
 
112
+ childResult(Key, (Key, Field, Value), Field) :-
113
+ listField(Key, Field, Value).
114
+
132
115
  resultField((Key, Field, Value), "value", Value, "shortText") :-
133
- childResult(Key, (Key, Field, Value), Field),
134
- field(Key, Field, Value),
135
- not resultField(Key, Field, Value, "list"),
136
- dataType(Key, Field, "list").
116
+ listField(Key, Field, Value).
137
117
 
138
118
  resultField((Key, Field, Value), "index", Index, "integer") :-
139
- childResult(Key, (Key, Field, Value), Field),
140
- field(Key, Field, Value),
141
- dataType(Key, Field, "list"),
142
- not resultField(Key, Field, Value, "list"),
119
+ listField(Key, Field, Value),
143
120
  field((Field, Value), "index", Index).
144
121
 
145
122
  resultField((Key, Field, Value), "displayName", EnumDisplayValue, "shortText") :-
146
- childResult(Key, (Key, Field, Value), Field),
147
- field(Key, Field, Value),
148
- dataType(Key, Field, "list"),
149
- not resultField(Key, Field, Value, "list"),
123
+ listField(Key, Field, Value),
150
124
  field((Field, Value), "enumDisplayValue", EnumDisplayValue).
151
125
 
152
126
  % enum
127
+ enumField(Key, Field, Value) :-
128
+ resultField(Key, Field, Value, "enum").
153
129
 
154
-
155
- childObject(Key, (Key, Field), Field) :-
156
- DataType = "enum",
157
- resultField(Key, Field, _, DataType).
158
-
159
- resultField((Key, Field), "value", Value, "shortText") :-
160
- childObject(Key, (Key, Field), Field),
161
- resultField(Key, Field, Value, _).
162
-
163
- resultField((Key, Field), "index", Index, "integer") :-
164
- childObject(Key, (Key, Field), Field),
165
- resultField(Key, Field, Value, _),
166
- field((Field, Value), "index", Index).
167
-
168
- resultField((Key, Field), "displayValue", EnumDisplayValue, "shortText") :-
169
- childObject(Key, (Key, Field), Field),
170
- resultField(Key, Field, Value, _),
171
- field((Field, Value), "enumDisplayValue", EnumDisplayValue).
172
-
173
-
174
- childObject(Key, (Key, Field), Field) :-
175
- field(Key, Field, _),
130
+ enumField(Key, Field, Value) :-
131
+ field(Key, Field, Value),
176
132
  dataType(Key, Field, "enum"),
177
133
  showField(Key, Field).
178
134
 
135
+ childObject(Key, (Key, Field), Field) :-
136
+ enumField(Key, Field, _).
137
+
179
138
  resultField((Key, Field), "value", Value, "shortText") :-
180
- childObject(Key, (Key, Field), Field),
181
- field(Key, Field, Value),
182
- not resultField(Key, Field, Value, "enum"),
183
- dataType(Key, Field, "enum").
139
+ enumField(Key, Field, Value).
184
140
 
185
141
  resultField((Key, Field), "index", Index, "integer") :-
186
- childObject(Key, (Key, Field), Field),
187
- field(Key, Field, Value),
188
- dataType(Key, Field, "enum"),
189
- not resultField(Key, Field, Value, "enum"),
142
+ enumField(Key, Field, Value),
190
143
  field((Field, Value), "index", Index).
191
144
 
192
145
  resultField((Key, Field), "displayValue", EnumDisplayValue, "shortText") :-
193
- childObject(Key, (Key, Field), Field),
194
- field(Key, Field, Value),
195
- dataType(Key, Field, "enum"),
196
- not resultField(Key, Field, Value, "enum"),
146
+ enumField(Key, Field, Value),
197
147
  field((Field, Value), "enumDisplayValue", EnumDisplayValue).
198
148
 
199
149
  % Allow specifying up to 3 fields at the same time
@@ -7,12 +7,14 @@ result(X) :- projectCard(X).
7
7
  % a helper term for display names
8
8
 
9
9
  displayName(Card, (Card, Field), DisplayName) :-
10
+ result(Card),
10
11
  fieldType(Field),
11
12
  field(Field, "displayName", DisplayName),
12
13
  field(Card, "cardType", CardType),
13
14
  not field((CardType, Field), "displayName", _).
14
15
 
15
16
  displayName(Card, (Card, Field), DisplayName) :-
17
+ result(Card),
16
18
  field(Card, "cardType", CardType),
17
19
  fieldType(Field),
18
20
  field((CardType, Field), "displayName", DisplayName).
@@ -135,4 +137,5 @@ dataType((Field, EnumValue), "index", "integer") :-
135
137
 
136
138
  order(2, "fields", 1, "visibility", "ASC").
137
139
  order(2, "fields", 2, "index", "ASC").
140
+ order(2, "links", 1, "linkSource", "DESC").
138
141
  order(3, "enumValues", 1, "index", "ASC").
@@ -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}}