@cyberismo/assets 0.0.6
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/README.md +1 -0
- package/dist/index.d.ts +21 -0
- package/dist/index.js +612 -0
- package/dist/schemas.d.ts +1132 -0
- package/dist/static/defaultReport/.schema +7 -0
- package/dist/static/defaultReport/index.adoc.hbs +3 -0
- package/dist/static/defaultReport/parameterSchema.json +18 -0
- package/dist/static/defaultReport/query.lp.hbs +2 -0
- package/package.json +30 -0
- package/src/calculations/common/base.lp +71 -0
- package/src/calculations/common/queryLanguage.lp +418 -0
- package/src/calculations/queries/card.lp +129 -0
- package/src/calculations/queries/onCreation.lp +44 -0
- package/src/calculations/queries/onTransition.lp +26 -0
- package/src/calculations/queries/tree.lp +6 -0
- package/src/calculations/test/model.lp +9 -0
- package/src/declarations.d.ts +9 -0
- package/src/graphvizReport/index.adoc.hbs +34 -0
- package/src/graphvizReport/query.lp.hbs +141 -0
- package/src/index.ts +52 -0
- package/src/schema/cardBaseSchema.json +76 -0
- package/src/schema/cardTreeDirectorySchema.json +663 -0
- package/src/schema/cardsConfigSchema.json +49 -0
- package/src/schema/csvSchema.json +30 -0
- package/src/schema/dotSchema.json +25 -0
- package/src/schema/macros/createCardsMacroSchema.json +39 -0
- package/src/schema/macros/graphMacroBaseSchema.json +17 -0
- package/src/schema/macros/reportMacroBaseSchema.json +13 -0
- package/src/schema/macros/scoreCardMacroSchema.json +24 -0
- package/src/schema/resources/cardTypeSchema.json +65 -0
- package/src/schema/resources/fieldTypeSchema.json +47 -0
- package/src/schema/resources/graphModelSchema.json +28 -0
- package/src/schema/resources/graphViewSchema.json +28 -0
- package/src/schema/resources/linkTypeSchema.json +56 -0
- package/src/schema/resources/reportSchema.json +28 -0
- package/src/schema/resources/templateSchema.json +28 -0
- package/src/schema/resources/workflowSchema.json +75 -0
- package/src/schema/schema.json +166 -0
- package/src/schemas.ts +54 -0
- package/src/static/defaultReport/.schema +7 -0
- package/src/static/defaultReport/index.adoc.hbs +3 -0
- package/src/static/defaultReport/parameterSchema.json +18 -0
- package/src/static/defaultReport/query.lp.hbs +2 -0
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
{
|
|
2
|
+
"title": "Report",
|
|
3
|
+
"$id": "reportMacroDefaultSchema",
|
|
4
|
+
"description": "A report object provides supplemental information about a report",
|
|
5
|
+
"type": "object",
|
|
6
|
+
"properties": {
|
|
7
|
+
"name": {
|
|
8
|
+
"description": "The name of the report",
|
|
9
|
+
"type": "string"
|
|
10
|
+
},
|
|
11
|
+
"cardKey": {
|
|
12
|
+
"description": "Used to override the default cardKey, which is the cardKey of the card, in which the report macro is used",
|
|
13
|
+
"type": "string"
|
|
14
|
+
}
|
|
15
|
+
},
|
|
16
|
+
"additionalProperties": false,
|
|
17
|
+
"required": ["name"]
|
|
18
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@cyberismo/assets",
|
|
3
|
+
"version": "0.0.6",
|
|
4
|
+
"description": "This package contains static resources",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"types": "dist/index.d.ts",
|
|
7
|
+
"keywords": [],
|
|
8
|
+
"author": "sami.merila@cyberismo.com",
|
|
9
|
+
"license": "AGPL-3.0",
|
|
10
|
+
"homepage": "https://github.com/CyberismoCom/cyberismo",
|
|
11
|
+
"repository": {
|
|
12
|
+
"type": "git",
|
|
13
|
+
"url": "git+https://github.com/CyberismoCom/cyberismo.git"
|
|
14
|
+
},
|
|
15
|
+
"bugs": "https://github.com/CyberismoCom/cyberismo/issues",
|
|
16
|
+
"type": "module",
|
|
17
|
+
"devDependencies": {
|
|
18
|
+
"esbuild": "^0.25.4",
|
|
19
|
+
"esbuild-plugin-import-glob": "^0.1.1"
|
|
20
|
+
},
|
|
21
|
+
"files": [
|
|
22
|
+
"dist",
|
|
23
|
+
"src"
|
|
24
|
+
],
|
|
25
|
+
"scripts": {
|
|
26
|
+
"build": "shx rm -rf dist && shx mkdir -p dist && pnpm script:schemas && node scripts/build.js && tsc && shx cp -r src/static dist/",
|
|
27
|
+
"dev": "chokidar 'src/**/*' -c 'pnpm build'",
|
|
28
|
+
"script:schemas": "node scripts/generateSchemaImports && prettier --write src/schemas.ts"
|
|
29
|
+
}
|
|
30
|
+
}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
%
|
|
2
|
+
% Common definitions for all Cards projects
|
|
3
|
+
%
|
|
4
|
+
|
|
5
|
+
% parent and ancestor
|
|
6
|
+
ancestor(A, C) :- parent(A, C), card(A), card(C).
|
|
7
|
+
ancestor(A, C) :- parent(A, C), card(A), template(C).
|
|
8
|
+
ancestor(A, C) :- parent(A, B), ancestor (B, C), card(A), card(B), card(C).
|
|
9
|
+
ancestor(A, C) :- parent(A, B), ancestor (B, C), card(A), card(B), template(C).
|
|
10
|
+
|
|
11
|
+
% if the card type is given, then it's a card
|
|
12
|
+
card(C) :- field(C, "cardType", _).
|
|
13
|
+
|
|
14
|
+
projectCard(C) :- card(C), field(C, "container", "project").
|
|
15
|
+
templateCard(C) :- card(C), field(C, "container", "template").
|
|
16
|
+
|
|
17
|
+
% data types for non-shortText default values
|
|
18
|
+
|
|
19
|
+
dataType(Card, "lastUpdated", "dateTime") :-
|
|
20
|
+
field(Card, "lastUpdated", _).
|
|
21
|
+
|
|
22
|
+
% add workflow state category as a calculated field for Cards
|
|
23
|
+
field(Card, "workflowStateCategory", Category) :-
|
|
24
|
+
card(Card),
|
|
25
|
+
field(Card, "workflowState", State),
|
|
26
|
+
field(Card, "cardType", CardType),
|
|
27
|
+
field(CardType, "workflow", Workflow),
|
|
28
|
+
workflowState(Workflow, State, Category).
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
% data types of fields
|
|
32
|
+
dataType(Key, Field, DataType) :-
|
|
33
|
+
field(Key, Field, _),
|
|
34
|
+
fieldType(Field),
|
|
35
|
+
field(Field, "dataType", DataType).
|
|
36
|
+
|
|
37
|
+
% data types for enum values
|
|
38
|
+
|
|
39
|
+
dataType((FieldType, EnumValue), "index", "integer") :-
|
|
40
|
+
enumValue(FieldType, EnumValue).
|
|
41
|
+
|
|
42
|
+
dataType((FieldType, EnumValue), "enumDisplayValue", "shortText") :-
|
|
43
|
+
enumValue(FieldType, EnumValue).
|
|
44
|
+
|
|
45
|
+
dataType((FieldType, EnumValue), "enumDescription", "longText") :-
|
|
46
|
+
enumValue(FieldType, EnumValue).
|
|
47
|
+
|
|
48
|
+
dataType((FieldType, EnumValue), "enumValue", "longText") :-
|
|
49
|
+
enumValue(FieldType, EnumValue).
|
|
50
|
+
|
|
51
|
+
% descendants of hidden cards are hidden
|
|
52
|
+
|
|
53
|
+
hiddenInTreeView(Card) :-
|
|
54
|
+
ancestor(Card, Ancestor),
|
|
55
|
+
hiddenInTreeView(Ancestor).
|
|
56
|
+
|
|
57
|
+
% TODO: remove this compatibility rule, once content repositories have been updated (INTDEV-666)
|
|
58
|
+
field(Card, "progress", Progress) :- field(Card, "base/fieldTypes/progress", Progress).
|
|
59
|
+
|
|
60
|
+
% user-defined links are links
|
|
61
|
+
link(Source, Destination, LinkType) :- userLink(Source, Destination, LinkType).
|
|
62
|
+
link(Source, Destination, LinkType, LinkDescription) :- userLink(Source, Destination, LinkType, LinkDescription).
|
|
63
|
+
|
|
64
|
+
% if a link is not user-defined, then it is calculated
|
|
65
|
+
calculatedLink(Source, Destination, LinkType) :-
|
|
66
|
+
link(Source, Destination, LinkType),
|
|
67
|
+
not userLink(Source, Destination, LinkType).
|
|
68
|
+
|
|
69
|
+
calculatedLink(Source, Destination, LinkType, LinkDescription) :-
|
|
70
|
+
link(Source, Destination, LinkType, LinkDescription),
|
|
71
|
+
not userLink(Source, Destination, LinkType, LinkDescription).
|
|
@@ -0,0 +1,418 @@
|
|
|
1
|
+
% Cyberismo query language
|
|
2
|
+
|
|
3
|
+
% select(n, collection, field): on result level n and for "collection", "field" should be returned
|
|
4
|
+
% selectCollectionField(collection, field): on all result levels for "collection", "field" should be returned
|
|
5
|
+
% selectAll(n): on result level n, all fields should be returned for all collections
|
|
6
|
+
% select(field): "field" should be returned on all levels of hierarchy for all collections
|
|
7
|
+
% selectAll: all fields should be returned on all levels of hierarchy for all collections
|
|
8
|
+
|
|
9
|
+
% select works similarly for "labels", "links", "notifications", "policyChecks" and "deniedOperations" as it works for fields
|
|
10
|
+
|
|
11
|
+
select(N, Collection, Field) :- select(Field), resultLevel(_, N, Collection).
|
|
12
|
+
|
|
13
|
+
selectAll(N) :- selectAll, resultLevel(_, N, _).
|
|
14
|
+
|
|
15
|
+
select(N, Collection, Field) :-
|
|
16
|
+
selectCollectionField(Collection, Field),
|
|
17
|
+
resultLevel(_, N, Collection).
|
|
18
|
+
|
|
19
|
+
% the default child result collection is "results"
|
|
20
|
+
childResult(Key, Child, "results") :- childResult(Key, Child).
|
|
21
|
+
|
|
22
|
+
% resultLevel(key, n, collection): result "key" is on result level n in "collection"
|
|
23
|
+
resultLevel(Key, 1, "results") :- result(Key).
|
|
24
|
+
resultLevel(Child, N+1, Collection) :- childResult(Key, Child, Collection), resultLevel(Key, N, _).
|
|
25
|
+
|
|
26
|
+
% result(key): key is a result of the query
|
|
27
|
+
#show result(Key) : result(Key), not queryError.
|
|
28
|
+
|
|
29
|
+
% childResult(key, child key): child key is a child result of key
|
|
30
|
+
#show childResult(Key, Child, Collection) : childResult(Key, Child, Collection), not queryError.
|
|
31
|
+
|
|
32
|
+
% helpers for simplifying some of the #show statements
|
|
33
|
+
|
|
34
|
+
% resultOrChildResult(key): key is included in the results as a result or a child result
|
|
35
|
+
resultOrChildResult(Key) :- result(Key).
|
|
36
|
+
resultOrChildResult(Key) :- childResult(_, Key, _).
|
|
37
|
+
|
|
38
|
+
% showAll(key): whether all fields or field-like things of a key should be included in the results
|
|
39
|
+
showAll(Key) :-
|
|
40
|
+
resultOrChildResult(Key),
|
|
41
|
+
resultLevel(Key, Level, _),
|
|
42
|
+
selectAll(Level),
|
|
43
|
+
not queryError.
|
|
44
|
+
|
|
45
|
+
% showField: whether a certain field or field-like thing of a key should be included in the results
|
|
46
|
+
showField(Key, Field) :-
|
|
47
|
+
resultOrChildResult(Key),
|
|
48
|
+
resultLevel(Key, Level, _),
|
|
49
|
+
select(Level, Field),
|
|
50
|
+
not queryError.
|
|
51
|
+
|
|
52
|
+
showField(Key, Field) :-
|
|
53
|
+
resultOrChildResult(Key),
|
|
54
|
+
resultLevel(Key, Level, Collection),
|
|
55
|
+
select(Level, Collection, Field),
|
|
56
|
+
not queryError.
|
|
57
|
+
|
|
58
|
+
% Fields
|
|
59
|
+
%
|
|
60
|
+
% field(key, field, value, data type):
|
|
61
|
+
% "field" of result/child result "key" has value "value",
|
|
62
|
+
% data type of the field is included, if not specified, it is shortText
|
|
63
|
+
% a field term like this is returned for all other fields except enum and list
|
|
64
|
+
%
|
|
65
|
+
% enumField(key, field, value, index, enum display value):
|
|
66
|
+
% listField(key, field, value, index, enum display value):
|
|
67
|
+
% otherwise the same as field, but for enum and list fields,
|
|
68
|
+
% we also need the enum value index and enum display value
|
|
69
|
+
|
|
70
|
+
#show field(Key, Field, Value, DataType) :
|
|
71
|
+
field(Key, Field, Value),
|
|
72
|
+
dataType(Key, Field, DataType),
|
|
73
|
+
DataType != "enum",
|
|
74
|
+
DataType != "list",
|
|
75
|
+
showField(Key, Field).
|
|
76
|
+
|
|
77
|
+
#show field(Key, Field, Value, DataType) :
|
|
78
|
+
field(Key, Field, Value),
|
|
79
|
+
dataType(Key, Field, DataType),
|
|
80
|
+
DataType != "enum",
|
|
81
|
+
DataType != "list",
|
|
82
|
+
showAll(Key).
|
|
83
|
+
|
|
84
|
+
#show field(Key, Field, Value, "shortText") :
|
|
85
|
+
field(Key, Field, Value),
|
|
86
|
+
not dataType(Key, Field, _),
|
|
87
|
+
showField(Key, Field).
|
|
88
|
+
|
|
89
|
+
#show field(Key, Field, Value, "shortText") :
|
|
90
|
+
field(Key, Field, Value),
|
|
91
|
+
not dataType(Key, Field, _),
|
|
92
|
+
showAll(Key).
|
|
93
|
+
|
|
94
|
+
#show enumField(Key, Field, Value, Index, DisplayValue) :
|
|
95
|
+
field(Key, Field, Value),
|
|
96
|
+
dataType(Key, Field, "enum"),
|
|
97
|
+
field((Field, Value), "index", Index),
|
|
98
|
+
field((Field, Value), "enumDisplayValue", DisplayValue),
|
|
99
|
+
showField(Key, Field).
|
|
100
|
+
|
|
101
|
+
#show enumField(Key, Field, Value, Index, Value) :
|
|
102
|
+
field(Key, Field, Value),
|
|
103
|
+
dataType(Key, Field, "enum"),
|
|
104
|
+
field((Field, Value), "index", Index),
|
|
105
|
+
not field((Field, Value), "enumDisplayValue", _),
|
|
106
|
+
showField(Key, Field).
|
|
107
|
+
|
|
108
|
+
#show enumField(Key, Field, Value) :
|
|
109
|
+
field(Key, Field, Value),
|
|
110
|
+
dataType(Key, Field, "enum"),
|
|
111
|
+
not field((Field, Value), "index", _),
|
|
112
|
+
not field((Field, Value), "enumDisplayValue", _),
|
|
113
|
+
showField(Key, Field).
|
|
114
|
+
|
|
115
|
+
#show enumField(Key, Field, Value, Index, DisplayValue) :
|
|
116
|
+
field(Key, Field, Value),
|
|
117
|
+
dataType(Key, Field, "enum"),
|
|
118
|
+
field((Field, Value), "index", Index),
|
|
119
|
+
field((Field, Value), "enumDisplayValue", DisplayValue),
|
|
120
|
+
showAll(Key).
|
|
121
|
+
|
|
122
|
+
#show enumField(Key, Field, Value, Index, Value) :
|
|
123
|
+
field(Key, Field, Value),
|
|
124
|
+
dataType(Key, Field, "enum"),
|
|
125
|
+
field((Field, Value), "index", Index),
|
|
126
|
+
not field((Field, Value), "enumDisplayValue", _),
|
|
127
|
+
showAll(Key).
|
|
128
|
+
|
|
129
|
+
#show enumField(Key, Field, Value) :
|
|
130
|
+
field(Key, Field, Value),
|
|
131
|
+
dataType(Key, Field, "enum"),
|
|
132
|
+
not field((Field, Value), "index", _),
|
|
133
|
+
not field((Field, Value), "enumDisplayValue", _),
|
|
134
|
+
showAll(Key).
|
|
135
|
+
|
|
136
|
+
#show listField(Key, Field, Value, Index, DisplayValue) :
|
|
137
|
+
field(Key, Field, Value),
|
|
138
|
+
dataType(Key, Field, "list"),
|
|
139
|
+
field((Field, Value), "index", Index),
|
|
140
|
+
field((Field, Value), "enumDisplayValue", DisplayValue),
|
|
141
|
+
showField(Key, Field).
|
|
142
|
+
|
|
143
|
+
#show listField(Key, Field, Value, Index, Value) :
|
|
144
|
+
field(Key, Field, Value),
|
|
145
|
+
dataType(Key, Field, "list"),
|
|
146
|
+
field((Field, Value), "index", Index),
|
|
147
|
+
not field((Field, Value), "enumDisplayValue", _),
|
|
148
|
+
showField(Key, Field).
|
|
149
|
+
|
|
150
|
+
#show listField(Key, Field, Value) :
|
|
151
|
+
field(Key, Field, Value),
|
|
152
|
+
dataType(Key, Field, "list"),
|
|
153
|
+
not field((Field, Value), "index", _),
|
|
154
|
+
not field((Field, Value), "enumDisplayValue", _),
|
|
155
|
+
showField(Key, Field).
|
|
156
|
+
|
|
157
|
+
#show listField(Key, Field, Value, Index, DisplayValue) :
|
|
158
|
+
field(Key, Field, Value),
|
|
159
|
+
dataType(Key, Field, "list"),
|
|
160
|
+
field((Field, Value), "index", Index),
|
|
161
|
+
field((Field, Value), "enumDisplayValue", DisplayValue),
|
|
162
|
+
showAll(Key).
|
|
163
|
+
|
|
164
|
+
#show listField(Key, Field, Value, Index, Value) :
|
|
165
|
+
field(Key, Field, Value),
|
|
166
|
+
dataType(Key, Field, "list"),
|
|
167
|
+
field((Field, Value), "index", Index),
|
|
168
|
+
not field((Field, Value), "enumDisplayValue", _),
|
|
169
|
+
showAll(Key).
|
|
170
|
+
|
|
171
|
+
#show listField(Key, Field, Value) :
|
|
172
|
+
field(Key, Field, Value),
|
|
173
|
+
dataType(Key, Field, "list"),
|
|
174
|
+
not field((Field, Value), "index", _),
|
|
175
|
+
not field((Field, Value), "enumDisplayValue", _),
|
|
176
|
+
showAll(Key).
|
|
177
|
+
|
|
178
|
+
% label(key, label): key is tagged with "label"
|
|
179
|
+
|
|
180
|
+
#show label(Key, Label) :
|
|
181
|
+
label(Key, Label),
|
|
182
|
+
showField(Key, "labels").
|
|
183
|
+
|
|
184
|
+
#show label(Key, Label) :
|
|
185
|
+
label(Key, Label),
|
|
186
|
+
showAll(Key).
|
|
187
|
+
|
|
188
|
+
% links
|
|
189
|
+
|
|
190
|
+
#show link(Source, Destination, DestinationTitle, LinkType, OutboundDisplayName, "outbound", "user", LinkDescription) :
|
|
191
|
+
userLink(Source, Destination, LinkType, LinkDescription),
|
|
192
|
+
field(Destination, "title", DestinationTitle),
|
|
193
|
+
field(LinkType, "outboundDisplayName", OutboundDisplayName),
|
|
194
|
+
showField(Source, "links").
|
|
195
|
+
|
|
196
|
+
#show link(Destination, Source, SourceTitle, LinkType, InboundDisplayName, "inbound", "user", LinkDescription) :
|
|
197
|
+
userLink(Source, Destination, LinkType, LinkDescription),
|
|
198
|
+
field(Source, "title", SourceTitle),
|
|
199
|
+
field(LinkType, "inboundDisplayName", InboundDisplayName),
|
|
200
|
+
showField(Destination, "links").
|
|
201
|
+
|
|
202
|
+
#show link(Source, Destination, DestinationTitle, LinkType, OutboundDisplayName, "outbound", "user", LinkDescription) :
|
|
203
|
+
userLink(Source, Destination, LinkType, LinkDescription),
|
|
204
|
+
field(Destination, "title", DestinationTitle),
|
|
205
|
+
field(LinkType, "outboundDisplayName", OutboundDisplayName),
|
|
206
|
+
showAll(Source).
|
|
207
|
+
|
|
208
|
+
#show link(Destination, Source, SourceTitle, LinkType, InboundDisplayName, "inbound", "user", LinkDescription) :
|
|
209
|
+
userLink(Source, Destination, LinkType, LinkDescription),
|
|
210
|
+
field(Source, "title", SourceTitle),
|
|
211
|
+
field(LinkType, "inboundDisplayName", InboundDisplayName),
|
|
212
|
+
showAll(Destination).
|
|
213
|
+
|
|
214
|
+
#show link(Source, Destination, DestinationTitle, LinkType, OutboundDisplayName, "outbound", "user") :
|
|
215
|
+
userLink(Source, Destination, LinkType),
|
|
216
|
+
field(Destination, "title", DestinationTitle),
|
|
217
|
+
field(LinkType, "outboundDisplayName", OutboundDisplayName),
|
|
218
|
+
showField(Source, "links").
|
|
219
|
+
|
|
220
|
+
#show link(Destination, Source, SourceTitle, LinkType, InboundDisplayName, "inbound", "user") :
|
|
221
|
+
userLink(Source, Destination, LinkType),
|
|
222
|
+
field(Source, "title", SourceTitle),
|
|
223
|
+
field(LinkType, "inboundDisplayName", InboundDisplayName),
|
|
224
|
+
showField(Destination, "links").
|
|
225
|
+
|
|
226
|
+
#show link(Source, Destination, DestinationTitle, LinkType, OutboundDisplayName, "outbound", "user") :
|
|
227
|
+
userLink(Source, Destination, LinkType),
|
|
228
|
+
field(Destination, "title", DestinationTitle),
|
|
229
|
+
field(LinkType, "outboundDisplayName", OutboundDisplayName),
|
|
230
|
+
showAll(Source).
|
|
231
|
+
|
|
232
|
+
#show link(Destination, Source, SourceTitle, LinkType, InboundDisplayName, "inbound", "user") :
|
|
233
|
+
userLink(Source, Destination, LinkType),
|
|
234
|
+
field(Source, "title", SourceTitle),
|
|
235
|
+
field(LinkType, "inboundDisplayName", InboundDisplayName),
|
|
236
|
+
showAll(Destination).
|
|
237
|
+
|
|
238
|
+
#show link(Source, Destination, DestinationTitle, LinkType, OutboundDisplayName, "outbound", "calculated", LinkDescription) :
|
|
239
|
+
calculatedLink(Source, Destination, LinkType, LinkDescription),
|
|
240
|
+
field(Destination, "title", DestinationTitle),
|
|
241
|
+
field(LinkType, "outboundDisplayName", OutboundDisplayName),
|
|
242
|
+
showField(Source, "links").
|
|
243
|
+
|
|
244
|
+
#show link(Destination, Source, SourceTitle, LinkType, InboundDisplayName, "inbound", "calculated", LinkDescription) :
|
|
245
|
+
calculatedLink(Source, Destination, LinkType, LinkDescription),
|
|
246
|
+
field(Source, "title", SourceTitle),
|
|
247
|
+
field(LinkType, "inboundDisplayName", InboundDisplayName),
|
|
248
|
+
showField(Destination, "links").
|
|
249
|
+
|
|
250
|
+
#show link(Source, Destination, DestinationTitle, LinkType, OutboundDisplayName, "outbound", "calculated", LinkDescription) :
|
|
251
|
+
calculatedLink(Source, Destination, LinkType, LinkDescription),
|
|
252
|
+
field(Destination, "title", DestinationTitle),
|
|
253
|
+
field(LinkType, "outboundDisplayName", OutboundDisplayName),
|
|
254
|
+
showAll(Source).
|
|
255
|
+
|
|
256
|
+
#show link(Destination, Source, SourceTitle, LinkType, InboundDisplayName, "inbound", "calculated", LinkDescription) :
|
|
257
|
+
calculatedLink(Source, Destination, LinkType, LinkDescription),
|
|
258
|
+
field(Source, "title", SourceTitle),
|
|
259
|
+
field(LinkType, "inboundDisplayName", InboundDisplayName),
|
|
260
|
+
showAll(Destination).
|
|
261
|
+
|
|
262
|
+
#show link(Source, Destination, DestinationTitle, LinkType, OutboundDisplayName, "outbound", "calculated") :
|
|
263
|
+
calculatedLink(Source, Destination, LinkType),
|
|
264
|
+
field(Destination, "title", DestinationTitle),
|
|
265
|
+
field(LinkType, "outboundDisplayName", OutboundDisplayName),
|
|
266
|
+
showField(Source, "links").
|
|
267
|
+
|
|
268
|
+
#show link(Destination, Source, SourceTitle, LinkType, InboundDisplayName, "inbound", "calculated") :
|
|
269
|
+
calculatedLink(Source, Destination, LinkType),
|
|
270
|
+
field(Source, "title", SourceTitle),
|
|
271
|
+
field(LinkType, "inboundDisplayName", InboundDisplayName),
|
|
272
|
+
showField(Destination, "links").
|
|
273
|
+
|
|
274
|
+
#show link(Source, Destination, DestinationTitle, LinkType, OutboundDisplayName, "outbound", "calculated") :
|
|
275
|
+
calculatedLink(Source, Destination, LinkType),
|
|
276
|
+
field(Destination, "title", DestinationTitle),
|
|
277
|
+
field(LinkType, "outboundDisplayName", OutboundDisplayName),
|
|
278
|
+
showAll(Source).
|
|
279
|
+
|
|
280
|
+
#show link(Destination, Source, SourceTitle, LinkType, InboundDisplayName, "inbound", "calculated") :
|
|
281
|
+
calculatedLink(Source, Destination, LinkType),
|
|
282
|
+
field(Source, "title", SourceTitle),
|
|
283
|
+
field(LinkType, "inboundDisplayName", InboundDisplayName),
|
|
284
|
+
showAll(Destination).
|
|
285
|
+
|
|
286
|
+
% notifications
|
|
287
|
+
|
|
288
|
+
#show notification(Key, Category, Title, Message) :
|
|
289
|
+
notification(Key, Category, Title, Message),
|
|
290
|
+
showField(Key, "notifications").
|
|
291
|
+
|
|
292
|
+
#show notification(Key, Category, Title, Message) :
|
|
293
|
+
notification(Key, Category, Title, Message),
|
|
294
|
+
showAll(Key).
|
|
295
|
+
|
|
296
|
+
% policy checks
|
|
297
|
+
|
|
298
|
+
#show policyCheckFailure(Key, Category, Title, ErrorMessage, Field) :
|
|
299
|
+
policyCheckFailure(Key, Category, Title, ErrorMessage, Field),
|
|
300
|
+
showField(Key, "policyChecks").
|
|
301
|
+
|
|
302
|
+
#show policyCheckFailure(Key, Category, Title, ErrorMessage, Field) :
|
|
303
|
+
policyCheckFailure(Key, Category, Title, ErrorMessage, Field),
|
|
304
|
+
showAll(Key).
|
|
305
|
+
|
|
306
|
+
#show policyCheckFailure(Key, Category, Title, ErrorMessage) :
|
|
307
|
+
policyCheckFailure(Key, Category, Title, ErrorMessage),
|
|
308
|
+
showField(Key, "policyChecks").
|
|
309
|
+
|
|
310
|
+
#show policyCheckFailure(Key, Category, Title, ErrorMessage) :
|
|
311
|
+
policyCheckFailure(Key, Category, Title, ErrorMessage),
|
|
312
|
+
showAll(Key).
|
|
313
|
+
|
|
314
|
+
#show policyCheckSuccess(Key, Category, Title) :
|
|
315
|
+
policyCheckSuccess(Key, Category, Title),
|
|
316
|
+
showField(Key, "policyChecks").
|
|
317
|
+
|
|
318
|
+
#show policyCheckSuccess(Key, Category, Title) :
|
|
319
|
+
policyCheckSuccess(Key, Category, Title),
|
|
320
|
+
showAll(Key).
|
|
321
|
+
|
|
322
|
+
% denied operations
|
|
323
|
+
|
|
324
|
+
#show transitionDenied(Key, Transition, ErrorMessage) :
|
|
325
|
+
transitionDenied(Key, Transition, ErrorMessage),
|
|
326
|
+
showField(Key, "deniedOperations").
|
|
327
|
+
|
|
328
|
+
#show transitionDenied(Key, Transition, ErrorMessage) :
|
|
329
|
+
transitionDenied(Key, Transition, ErrorMessage),
|
|
330
|
+
showAll(Key).
|
|
331
|
+
|
|
332
|
+
#show movingCardDenied(Key, ErrorMessage) :
|
|
333
|
+
movingCardDenied(Key, ErrorMessage),
|
|
334
|
+
showField(Key, "deniedOperations").
|
|
335
|
+
|
|
336
|
+
#show movingCardDenied(Key, ErrorMessage) :
|
|
337
|
+
movingCardDenied(Key, ErrorMessage),
|
|
338
|
+
showAll(Key).
|
|
339
|
+
|
|
340
|
+
#show deletingCardDenied(Key, ErrorMessage) :
|
|
341
|
+
deletingCardDenied(Key, ErrorMessage),
|
|
342
|
+
showField(Key, "deniedOperations").
|
|
343
|
+
|
|
344
|
+
#show deletingCardDenied(Key, ErrorMessage) :
|
|
345
|
+
deletingCardDenied(Key, ErrorMessage),
|
|
346
|
+
showAll(Key).
|
|
347
|
+
|
|
348
|
+
#show editingFieldDenied(Key, Field, ErrorMessage) :
|
|
349
|
+
editingFieldDenied(Key, Field, ErrorMessage),
|
|
350
|
+
showField(Key, "deniedOperations").
|
|
351
|
+
|
|
352
|
+
#show editingFieldDenied(Key, Field, ErrorMessage) :
|
|
353
|
+
editingFieldDenied(Key, Field, ErrorMessage),
|
|
354
|
+
showAll(Key).
|
|
355
|
+
|
|
356
|
+
#show editingContentDenied(Key, ErrorMessage) :
|
|
357
|
+
editingContentDenied(Key, ErrorMessage),
|
|
358
|
+
showField(Key, "deniedOperations").
|
|
359
|
+
|
|
360
|
+
#show editingContentDenied(Key, ErrorMessage) :
|
|
361
|
+
editingContentDenied(Key, ErrorMessage),
|
|
362
|
+
showAll(Key).
|
|
363
|
+
|
|
364
|
+
% order(n, collection, 1, field, direction): the results in the collection on level n should be first ordered by "field" in "direction"
|
|
365
|
+
% order(n, collection, 2, field, direction): the results in the collection on level n should be secondly ordered by "field" in "direction"
|
|
366
|
+
% etc.
|
|
367
|
+
% direction must be "ASC" or "DESC".
|
|
368
|
+
|
|
369
|
+
% orderBy is syntactic sugar for order, as you can order by 1..3 fields with one term when using the default collection "results"
|
|
370
|
+
|
|
371
|
+
% orderBy with an even numer of parameters refers to results on all levels of hierarchy.
|
|
372
|
+
order(N, "results", 1, Field, Direction) :- orderBy(Field, Direction), resultLevel(_, N, "results").
|
|
373
|
+
order(N, "results", 1, Field1, Direction1) :- orderBy(Field1, Direction1, _, _), resultLevel(_, N, "results").
|
|
374
|
+
order(N, "results", 2, Field2, Direction2) :- orderBy(_, _, Field2, Direction2), resultLevel(_, N, "results").
|
|
375
|
+
order(N, "results", 1, Field1, Direction1) :- orderBy(Field1, Direction1, _, _, _, _), resultLevel(_, N, "results").
|
|
376
|
+
order(N, "results", 2, Field2, Direction2) :- orderBy(_, _, Field2, Direction2, _, _), resultLevel(_, N, "results").
|
|
377
|
+
order(N, "results", 3, Field3, Direction3) :- orderBy(_, _, _, _, Field3, Direction3), resultLevel(_, N, "results").
|
|
378
|
+
|
|
379
|
+
% orderBy with an odd numer of parameters has the result level as the first parameter
|
|
380
|
+
order(Level, "results", 1, Field, Direction) :- orderBy(Level, Field, Direction).
|
|
381
|
+
order(Level, "results", 1, Field1, Direction1) :- orderBy(Level, Field1, Direction1, _, _).
|
|
382
|
+
order(Level, "results", 2, Field2, Direction2) :- orderBy(Level, _, _, Field2, Direction2).
|
|
383
|
+
order(Level, "results", 1, Field1, Direction1) :- orderBy(Level, Field1, Direction1, _, _, _, _).
|
|
384
|
+
order(Level, "results", 2, Field2, Direction2) :- orderBy(Level, _, _, Field2, Direction2, _, _).
|
|
385
|
+
order(Level, "results", 3, Field3, Direction3) :- orderBy(Level, _, _, _, _, Field3, Direction3).
|
|
386
|
+
|
|
387
|
+
% select the fields that are needed for sorting automatically
|
|
388
|
+
select(Level, Collection, Field) :- order(Level, Collection, _, Field, _).
|
|
389
|
+
|
|
390
|
+
queryError("Invalid direction in ordering:", (Level, Collection, Index, Field, Direction)) :-
|
|
391
|
+
order(Level, Collection, Index, Field, Direction),
|
|
392
|
+
Direction != "ASC",
|
|
393
|
+
Direction != "DESC".
|
|
394
|
+
|
|
395
|
+
queryError("Ordering direction missing:", (Field)) :- orderBy(Field).
|
|
396
|
+
|
|
397
|
+
queryError("Conflicting ordering for fields: ", (Field1, Field2)) :-
|
|
398
|
+
order(Level, Collection, Index, Field1, _),
|
|
399
|
+
order(Level, Collection, Index, Field2, _),
|
|
400
|
+
Field1 != Field2.
|
|
401
|
+
|
|
402
|
+
queryError("Conflicting ordering direction", (Field, Collection, Direction1, Direction2)) :-
|
|
403
|
+
order(Level, Collection, Index, Field, Direction1),
|
|
404
|
+
order(Level, Collection, Index, Field, Direction2),
|
|
405
|
+
Direction1 != Direction2.
|
|
406
|
+
|
|
407
|
+
queryError :- queryError(_, _).
|
|
408
|
+
|
|
409
|
+
#show order(Level, Collection, Index, Field, Direction) :
|
|
410
|
+
order(Level, Collection, Index, Field, Direction),
|
|
411
|
+
not queryError.
|
|
412
|
+
|
|
413
|
+
#show queryError/2.
|
|
414
|
+
|
|
415
|
+
% helper terms
|
|
416
|
+
|
|
417
|
+
level(Level) :-
|
|
418
|
+
resultLevel(_, Level, _).
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
{{#if cardKey}}
|
|
2
|
+
result({{cardKey}}).
|
|
3
|
+
{{else}}
|
|
4
|
+
result(X) :- projectCard(X).
|
|
5
|
+
{{/if}}
|
|
6
|
+
|
|
7
|
+
% a helper term for display names
|
|
8
|
+
|
|
9
|
+
displayName(Card, Field, DisplayName) :-
|
|
10
|
+
field(Card, Field, _),
|
|
11
|
+
fieldType(Field),
|
|
12
|
+
field(Field, "displayName", DisplayName),
|
|
13
|
+
field(Card, "cardType", CardType),
|
|
14
|
+
not field((CardType, Field), "displayName", _).
|
|
15
|
+
|
|
16
|
+
displayName(Card, Field, DisplayName) :-
|
|
17
|
+
field(Card, "cardType", CardType),
|
|
18
|
+
field((CardType, Field), "displayName", DisplayName).
|
|
19
|
+
|
|
20
|
+
% the second level includes metadata for the always visible and optionally visible fields
|
|
21
|
+
|
|
22
|
+
field(Field, "visibility", "always") :-
|
|
23
|
+
alwaysVisibleField(CardType, Field),
|
|
24
|
+
field(Card, "cardType", CardType),
|
|
25
|
+
result(Card).
|
|
26
|
+
|
|
27
|
+
field(Field, "visibility", "optional") :-
|
|
28
|
+
optionallyVisibleField(CardType, Field),
|
|
29
|
+
field(Card, "cardType", CardType),
|
|
30
|
+
result(Card).
|
|
31
|
+
|
|
32
|
+
field(Field, "index", Index) :-
|
|
33
|
+
alwaysVisibleField(CardType, Field),
|
|
34
|
+
field((CardType, Field), "index", Index),
|
|
35
|
+
field(Card, "cardType", CardType),
|
|
36
|
+
result(Card).
|
|
37
|
+
|
|
38
|
+
field(Field, "index", Index) :-
|
|
39
|
+
optionallyVisibleField(CardType, Field),
|
|
40
|
+
field((CardType, Field), "index", Index),
|
|
41
|
+
field(Card, "cardType", CardType),
|
|
42
|
+
result(Card).
|
|
43
|
+
|
|
44
|
+
dataType(Field, "fieldDisplayName", "shortText") :-
|
|
45
|
+
childResult(_, Field, "fields"),
|
|
46
|
+
field(Field, "fieldDisplayName", _).
|
|
47
|
+
|
|
48
|
+
field(Field, "fieldDisplayName", DisplayName) :-
|
|
49
|
+
childResult(_, Field, "fields"),
|
|
50
|
+
result(Card),
|
|
51
|
+
displayName(Card, Field, DisplayName).
|
|
52
|
+
|
|
53
|
+
dataType(Field, "isCalculated", "boolean") :-
|
|
54
|
+
childResult(_, Field, "fields"),
|
|
55
|
+
field(Field, "isCalculated", _).
|
|
56
|
+
|
|
57
|
+
field(Field, "isCalculated", true) :-
|
|
58
|
+
result(Card),
|
|
59
|
+
field(Card, "cardType", CardType),
|
|
60
|
+
calculatedField(CardType, Field).
|
|
61
|
+
|
|
62
|
+
field(Field, "isCalculated", false) :-
|
|
63
|
+
childResult(_, Field, "fields"),
|
|
64
|
+
result(Card),
|
|
65
|
+
field(Card, "cardType", CardType),
|
|
66
|
+
not calculatedField(CardType, Field).
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
% add value
|
|
72
|
+
dataType(Field, "value", DataType) :-
|
|
73
|
+
childResult(_, Field, "fields"),
|
|
74
|
+
result(Card),
|
|
75
|
+
field(Card, Field, Value),
|
|
76
|
+
dataType(Card, Field, DataType).
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
% add value
|
|
80
|
+
field(Field, "value", Value) :-
|
|
81
|
+
childResult(Card, Field, "fields"),
|
|
82
|
+
field(Card, Field, Value).
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
% select only non-custom fields
|
|
86
|
+
select(1, "cardType").
|
|
87
|
+
select(1, "title").
|
|
88
|
+
select(1, "key").
|
|
89
|
+
select(1, "lastUpdated").
|
|
90
|
+
select(1, "workflowState").
|
|
91
|
+
select(1, "notifications").
|
|
92
|
+
select(1, "policyChecks").
|
|
93
|
+
select(1, "links").
|
|
94
|
+
select(1, "deniedOperations").
|
|
95
|
+
select(1, "labels").
|
|
96
|
+
|
|
97
|
+
select(2, "visibility").
|
|
98
|
+
select(2, "index").
|
|
99
|
+
select(2, "fieldDisplayName").
|
|
100
|
+
select(2, "fieldDescription").
|
|
101
|
+
select(2, "dataType").
|
|
102
|
+
select(2, "isCalculated").
|
|
103
|
+
select(2, "value").
|
|
104
|
+
|
|
105
|
+
childResult(Card, Field, "fields") :-
|
|
106
|
+
alwaysVisibleField(CardType, Field),
|
|
107
|
+
field(Card, "cardType", CardType),
|
|
108
|
+
result(Card).
|
|
109
|
+
|
|
110
|
+
childResult(Card, Field, "fields") :-
|
|
111
|
+
optionallyVisibleField(CardType, Field),
|
|
112
|
+
field(Card, "cardType", CardType),
|
|
113
|
+
result(Card).
|
|
114
|
+
|
|
115
|
+
% for enum fields, add enum values as child results:
|
|
116
|
+
select(3, "index").
|
|
117
|
+
select(3, "enumDisplayValue").
|
|
118
|
+
select(3, "enumDescription").
|
|
119
|
+
select(3, "enumValue").
|
|
120
|
+
|
|
121
|
+
childResult(Field, (Field, EnumValue), "enumValues") :-
|
|
122
|
+
enumValue(Field, EnumValue).
|
|
123
|
+
|
|
124
|
+
field((Field, EnumValue), "enumValue", EnumValue) :-
|
|
125
|
+
enumValue(Field, EnumValue).
|
|
126
|
+
|
|
127
|
+
order(2, "fields", 1, "visibility", "ASC").
|
|
128
|
+
order(2, "fields", 2, "index", "ASC").
|
|
129
|
+
order(3, "enumValues", 1, "index", "ASC").
|