@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.
Files changed (44) hide show
  1. package/LICENSE +702 -0
  2. package/README.md +1 -0
  3. package/dist/index.d.ts +21 -0
  4. package/dist/index.js +612 -0
  5. package/dist/schemas.d.ts +1132 -0
  6. package/dist/static/defaultReport/.schema +7 -0
  7. package/dist/static/defaultReport/index.adoc.hbs +3 -0
  8. package/dist/static/defaultReport/parameterSchema.json +18 -0
  9. package/dist/static/defaultReport/query.lp.hbs +2 -0
  10. package/package.json +30 -0
  11. package/src/calculations/common/base.lp +71 -0
  12. package/src/calculations/common/queryLanguage.lp +418 -0
  13. package/src/calculations/queries/card.lp +129 -0
  14. package/src/calculations/queries/onCreation.lp +44 -0
  15. package/src/calculations/queries/onTransition.lp +26 -0
  16. package/src/calculations/queries/tree.lp +6 -0
  17. package/src/calculations/test/model.lp +9 -0
  18. package/src/declarations.d.ts +9 -0
  19. package/src/graphvizReport/index.adoc.hbs +34 -0
  20. package/src/graphvizReport/query.lp.hbs +141 -0
  21. package/src/index.ts +52 -0
  22. package/src/schema/cardBaseSchema.json +76 -0
  23. package/src/schema/cardTreeDirectorySchema.json +663 -0
  24. package/src/schema/cardsConfigSchema.json +49 -0
  25. package/src/schema/csvSchema.json +30 -0
  26. package/src/schema/dotSchema.json +25 -0
  27. package/src/schema/macros/createCardsMacroSchema.json +39 -0
  28. package/src/schema/macros/graphMacroBaseSchema.json +17 -0
  29. package/src/schema/macros/reportMacroBaseSchema.json +13 -0
  30. package/src/schema/macros/scoreCardMacroSchema.json +24 -0
  31. package/src/schema/resources/cardTypeSchema.json +65 -0
  32. package/src/schema/resources/fieldTypeSchema.json +47 -0
  33. package/src/schema/resources/graphModelSchema.json +28 -0
  34. package/src/schema/resources/graphViewSchema.json +28 -0
  35. package/src/schema/resources/linkTypeSchema.json +56 -0
  36. package/src/schema/resources/reportSchema.json +28 -0
  37. package/src/schema/resources/templateSchema.json +28 -0
  38. package/src/schema/resources/workflowSchema.json +75 -0
  39. package/src/schema/schema.json +166 -0
  40. package/src/schemas.ts +54 -0
  41. package/src/static/defaultReport/.schema +7 -0
  42. package/src/static/defaultReport/index.adoc.hbs +3 -0
  43. package/src/static/defaultReport/parameterSchema.json +18 -0
  44. package/src/static/defaultReport/query.lp.hbs +2 -0
@@ -0,0 +1,663 @@
1
+ {
2
+ "title": "Card directory tree schema",
3
+ "$id": "cardTreeDirectorySchema",
4
+ "description": "This schema represents the directory structure of a card tree, using the format of https://github.com/jpoehnelt/directory-schema-validator",
5
+ "type": "object",
6
+ "properties": {
7
+ "directories": {
8
+ "type": "object",
9
+ "properties": {
10
+ ".cards": {
11
+ "description": "Configuration for the card tree",
12
+ "type": "object",
13
+ "properties": {
14
+ "files": {
15
+ "type": "object",
16
+ "additionalProperties": false
17
+ },
18
+ "directories": {
19
+ "type": "object",
20
+ "additionalProperties": false,
21
+ "properties": {
22
+ "modules": {
23
+ "$ref": "#/$defs/cardModuleSchema"
24
+ },
25
+ "local": {
26
+ "type": "object",
27
+ "properties": {
28
+ "files": {
29
+ "type": "object",
30
+ "additionalProperties": false,
31
+ "properties": {
32
+ ".schema": {},
33
+ "cardsConfig.json": {}
34
+ },
35
+ "required": [".schema", "cardsConfig.json"]
36
+ },
37
+ "directories": {
38
+ "type": "object",
39
+ "additionalProperties": false,
40
+ "properties": {
41
+ "calculations": {
42
+ "$ref": "#/$defs/calculationResourceSchema"
43
+ },
44
+ "cardTypes": {
45
+ "$ref": "#/$defs/cardTypeResourceSchema"
46
+ },
47
+ "fieldTypes": {
48
+ "$ref": "#/$defs/fieldTypeResourceSchema"
49
+ },
50
+ "graphViews": {
51
+ "$ref": "#/$defs/graphViewResourceSchema"
52
+ },
53
+ "graphModels": {
54
+ "$ref": "#/$defs/graphModelResourceSchema"
55
+ },
56
+ "linkTypes": {
57
+ "$ref": "#/$defs/linkTypeResourceSchema"
58
+ },
59
+ "reports": {
60
+ "$ref": "#/$defs/reportResourceSchema"
61
+ },
62
+ "templates": {
63
+ "$ref": "#/$defs/templatesResourceSchema"
64
+ },
65
+ "workflows": {
66
+ "$ref": "#/$defs/workflowResourceSchema"
67
+ }
68
+ }
69
+ }
70
+ }
71
+ }
72
+ },
73
+ "required": ["local"]
74
+ }
75
+ }
76
+ },
77
+ "cardRoot": {
78
+ "description": "The contents of the card tree. Each subdirectory contains a top level card. The name of the directory is the card key.",
79
+ "type": "object",
80
+ "properties": {
81
+ "files": {
82
+ "type": "object",
83
+ "additionalProperties": false,
84
+ "properties": {
85
+ ".gitkeep": {},
86
+ ".schema": {}
87
+ }
88
+ },
89
+ "directories": {
90
+ "type": "object",
91
+ "additionalProperties": false,
92
+ "patternProperties": {
93
+ "^[a-z]+_[0-9a-z]+$": {
94
+ "$ref": "#/$defs/cardDirectorySchema#"
95
+ }
96
+ }
97
+ }
98
+ }
99
+ },
100
+ ".calc": {
101
+ "description": "Temporary files for calculations.",
102
+ "type": "object",
103
+ "properties": {
104
+ "directories": {
105
+ "type": "object",
106
+ "properties": {
107
+ "resources": {
108
+ "description": "Schema of the .calc resource folder",
109
+ "type": "object",
110
+ "properties": {
111
+ "files": {
112
+ "type": "object",
113
+ "additionalProperties": false,
114
+ "patternProperties": {
115
+ "^.+\\.lp$": {
116
+ "type": "object"
117
+ }
118
+ }
119
+ }
120
+ }
121
+ },
122
+ "cards": {
123
+ "description": "Directory that contains separate logic program files for each card",
124
+ "type": "object",
125
+ "properties": {
126
+ "files": {
127
+ "type": "object",
128
+ "additionalProperties": false,
129
+ "patternProperties": {
130
+ "^.+\\.lp$": {
131
+ "type": "object"
132
+ }
133
+ }
134
+ }
135
+ }
136
+ }
137
+ },
138
+ "additionalProperties": false
139
+ },
140
+ "files": {
141
+ "type": "object",
142
+ "properties": {
143
+ "base.lp": {
144
+ "description": "A logic program that contains basic common definitions that are the same in all cards projects",
145
+ "type": "object"
146
+ },
147
+ "calculations.lp": {
148
+ "description": "A logic program that only includes all the logic programs from modules, including the calculations from the local content",
149
+ "type": "object"
150
+ },
151
+ "cardTree.lp": {
152
+ "description": "A logic program that only includes all the card-specific logic programs",
153
+ "type": "object"
154
+ },
155
+ "resourceImports.lp": {
156
+ "description": "A logic program that only includes all the logic programs generated from resources",
157
+ "type": "object"
158
+ },
159
+ "main.lp": {
160
+ "description": "The main logic program",
161
+ "type": "object"
162
+ },
163
+ "modules.lp": {
164
+ "description": "",
165
+ "type": "object"
166
+ },
167
+ "queryLanguage.lp": {
168
+ "description": "A logic program that defines the Cyberismo query language",
169
+ "type": "object"
170
+ }
171
+ },
172
+ "additionalProperties": true
173
+ }
174
+ }
175
+ }
176
+ },
177
+ "required": [".cards", "cardRoot"]
178
+ }
179
+ },
180
+ "$defs": {
181
+ "cardModuleSchema": {
182
+ "description": "The schema for modules. Each module is in a named directory containing 'cardTypes', 'templates' and 'workflows'. ",
183
+ "type": "object",
184
+ "properties": {
185
+ "directories": {
186
+ "type": "object",
187
+ "patternProperties": {
188
+ "^[A-Za-z ._-]+$": {
189
+ "type": "object",
190
+ "properties": {
191
+ "directories": {
192
+ "type": "object",
193
+ "properties": {
194
+ "calculations": {
195
+ "$ref": "#/$defs/calculationResourceSchema"
196
+ },
197
+ "cardTypes": {
198
+ "$ref": "#/$defs/cardTypeResourceSchema"
199
+ },
200
+ "fieldTypes": {
201
+ "$ref": "#/$defs/fieldTypeResourceSchema"
202
+ },
203
+ "graphViews": {
204
+ "$ref": "#/$defs/graphViewResourceSchema"
205
+ },
206
+ "graphModels": {
207
+ "$ref": "#/$defs/graphModelResourceSchema"
208
+ },
209
+ "linkTypes": {
210
+ "$ref": "#/$defs/linkTypeResourceSchema"
211
+ },
212
+ "reports": {
213
+ "$ref": "#/$defs/reportResourceSchema"
214
+ },
215
+ "templates": {
216
+ "$ref": "#/$defs/templatesResourceSchema"
217
+ },
218
+ "workflows": {
219
+ "$ref": "#/$defs/workflowResourceSchema"
220
+ }
221
+ }
222
+ },
223
+ "files": {
224
+ "type": "object",
225
+ "additionalProperties": false,
226
+ "properties": {
227
+ ".schema": {},
228
+ "cardsConfig.json": {
229
+ "type": "object"
230
+ }
231
+ },
232
+ "required": ["cardsConfig.json", ".schema"]
233
+ }
234
+ }
235
+ }
236
+ }
237
+ }
238
+ }
239
+ },
240
+ "cardDirectorySchema": {
241
+ "description": "The directory schema of a card, using the format of https://github.com/jpoehnelt/directory-schema-validator",
242
+ "type": "object",
243
+ "properties": {
244
+ "name": {
245
+ "description": "The name of the card directory is the card key",
246
+ "type": "string",
247
+ "minLength": 5,
248
+ "maxLength": 20,
249
+ "pattern": "^[a-z]+_[0-9a-z]+$"
250
+ },
251
+ "files": {
252
+ "type": "object",
253
+ "additionalProperties": false,
254
+ "properties": {
255
+ ".schema": {},
256
+ "index.json": {
257
+ "description": "The fields of the card. This file must validate against both the cardBaseSchema.json and the custom fields of its card type",
258
+ "type": "object",
259
+ "$comment": "Each file needs to be separately validated against 'contentSchema'",
260
+ "contentSchema": "cardBaseSchema.json"
261
+ },
262
+ "index.adoc": {
263
+ "description": "The description field of the card as an Asciidoc file",
264
+ "type": "object"
265
+ },
266
+ "index.lp": {
267
+ "description": "Calculations specific to the card",
268
+ "type": "object"
269
+ }
270
+ },
271
+ "required": ["index.json", "index.adoc"]
272
+ },
273
+ "directories": {
274
+ "type": "object",
275
+ "additionalProperties": false,
276
+ "properties": {
277
+ "a": {
278
+ "description": "A directory for file attachments of the card",
279
+ "type": "object",
280
+ "properties": {
281
+ "directories": {
282
+ "type": "object",
283
+ "additionalProperties": false
284
+ }
285
+ }
286
+ },
287
+ "c": {
288
+ "description": "A directory for child cards",
289
+ "type": "object",
290
+ "properties": {
291
+ "directories": {
292
+ "$ref": "#/$defs/cardDirectorySchema#"
293
+ }
294
+ }
295
+ }
296
+ }
297
+ }
298
+ }
299
+ },
300
+ "calculationResourceSchema": {
301
+ "type": "object",
302
+ "properties": {
303
+ "directories": {
304
+ "type": "object",
305
+ "additionalProperties": false
306
+ },
307
+ "files": {
308
+ "type": "object",
309
+ "$comment": "Each file must be a logic program file",
310
+ "additionalProperties": false,
311
+ "patternProperties": {
312
+ "^.+\\.lp$": {
313
+ "type": "object"
314
+ }
315
+ },
316
+ "properties": {
317
+ ".gitkeep": {}
318
+ }
319
+ }
320
+ }
321
+ },
322
+ "cardTypeResourceSchema": {
323
+ "type": "object",
324
+ "allOf": [
325
+ {
326
+ "properties": {
327
+ "directories": {
328
+ "type": "object",
329
+ "additionalProperties": false
330
+ }
331
+ }
332
+ },
333
+ {
334
+ "properties": {
335
+ "files": {
336
+ "type": "object",
337
+ "$comment": "Each file needs to be separately validated against 'contentSchema'",
338
+ "contentSchema": "cardTypeSchema.json"
339
+ }
340
+ }
341
+ },
342
+ {
343
+ "properties": {
344
+ "files": {
345
+ "type": "object",
346
+ "properties": {
347
+ ".schema": {},
348
+ ".gitkeep": {}
349
+ },
350
+ "required": [".schema"]
351
+ }
352
+ }
353
+ }
354
+ ]
355
+ },
356
+ "fieldTypeResourceSchema": {
357
+ "type": "object",
358
+ "allOf": [
359
+ {
360
+ "properties": {
361
+ "directories": {
362
+ "type": "object",
363
+ "additionalProperties": false
364
+ }
365
+ }
366
+ },
367
+ {
368
+ "properties": {
369
+ "files": {
370
+ "type": "object",
371
+ "$comment": "Each file needs to be separately validated against 'contentSchema'",
372
+ "contentSchema": "cardTypeSchema.json"
373
+ }
374
+ }
375
+ },
376
+ {
377
+ "properties": {
378
+ "files": {
379
+ "type": "object",
380
+ "properties": {
381
+ ".schema": {},
382
+ ".gitkeep": {}
383
+ },
384
+ "required": [".schema"]
385
+ }
386
+ }
387
+ }
388
+ ]
389
+ },
390
+ "graphViewResourceSchema": {
391
+ "type": "object",
392
+ "properties": {
393
+ "additionalProperties": false,
394
+ "directories": {
395
+ "type": "object",
396
+ "additionalProperties": false,
397
+ "patternProperties": {
398
+ ".+": {
399
+ "type": "object",
400
+ "properties": {
401
+ "files": {
402
+ "type": "object",
403
+ "properties": {
404
+ "view.lp.hbs": {
405
+ "type": "object"
406
+ },
407
+ "parameterSchema.json": {
408
+ "type": "object"
409
+ }
410
+ },
411
+ "required": ["view.lp.hbs"]
412
+ }
413
+ }
414
+ }
415
+ }
416
+ }
417
+ }
418
+ },
419
+ "graphModelResourceSchema": {
420
+ "type": "object",
421
+ "properties": {
422
+ "additionalProperties": false,
423
+ "directories": {
424
+ "type": "object",
425
+ "additionalProperties": false,
426
+ "patternProperties": {
427
+ ".+": {
428
+ "type": "object",
429
+ "properties": {
430
+ "files": {
431
+ "type": "object",
432
+ "properties": {
433
+ "model.lp": {
434
+ "type": "object"
435
+ }
436
+ },
437
+ "required": ["model.lp"]
438
+ }
439
+ }
440
+ }
441
+ }
442
+ }
443
+ }
444
+ },
445
+ "linkTypeResourceSchema": {
446
+ "type": "object",
447
+ "allOf": [
448
+ {
449
+ "properties": {
450
+ "directories": {
451
+ "type": "object",
452
+ "additionalProperties": false
453
+ }
454
+ }
455
+ },
456
+ {
457
+ "properties": {
458
+ "files": {
459
+ "type": "object",
460
+ "$comment": "Each file needs to be separately validated against 'contentSchema'",
461
+ "contentSchema": "linkTypeSchema.json"
462
+ }
463
+ }
464
+ },
465
+ {
466
+ "properties": {
467
+ "files": {
468
+ "type": "object",
469
+ "properties": {
470
+ ".schema": {},
471
+ ".gitkeep": {}
472
+ },
473
+ "required": [".schema"]
474
+ }
475
+ }
476
+ }
477
+ ]
478
+ },
479
+ "reportResourceSchema": {
480
+ "type": "object",
481
+ "properties": {
482
+ "additionalProperties": false,
483
+ "files": {
484
+ "$comment": "reports folder can contain report configuration files (<name>.json), or .gitkeep",
485
+ "type": "object",
486
+ "additionalProperties": false,
487
+ "patternProperties": {
488
+ "^[A-Za-z0-9-_]+.json$": {
489
+ "type": "object"
490
+ },
491
+ "^.schema$": {
492
+ "type": "object"
493
+ },
494
+ "^.gitkeep$": {
495
+ "type": "object"
496
+ }
497
+ }
498
+ },
499
+ "directories": {
500
+ "type": "object",
501
+ "additionalProperties": false,
502
+ "patternProperties": {
503
+ ".+": {
504
+ "type": "object",
505
+ "properties": {
506
+ "files": {
507
+ "type": "object",
508
+ "additionalProperties": false,
509
+ "properties": {
510
+ "index.adoc.hbs": {
511
+ "type": "object"
512
+ },
513
+ "query.lp.hbs": {
514
+ "type": "object"
515
+ },
516
+ "parameterSchema.json": {
517
+ "type": "object"
518
+ },
519
+ ".schema": {
520
+ "type": "object"
521
+ }
522
+ },
523
+ "required": [".schema", "index.adoc.hbs", "query.lp.hbs"]
524
+ }
525
+ }
526
+ }
527
+ }
528
+ }
529
+ }
530
+ },
531
+ "workflowResourceSchema": {
532
+ "type": "object",
533
+ "allOf": [
534
+ {
535
+ "properties": {
536
+ "directories": {
537
+ "type": "object",
538
+ "additionalProperties": false
539
+ }
540
+ }
541
+ },
542
+ {
543
+ "properties": {
544
+ "files": {
545
+ "type": "object",
546
+ "$comment": "Each file needs to be separately validated against 'contentSchema'",
547
+ "contentSchema": "workflowSchema.json"
548
+ }
549
+ }
550
+ },
551
+ {
552
+ "properties": {
553
+ "files": {
554
+ "type": "object",
555
+ "properties": {
556
+ ".schema": {},
557
+ ".gitkeep": {}
558
+ },
559
+ "required": [".schema"]
560
+ }
561
+ }
562
+ }
563
+ ]
564
+ },
565
+ "templatesResourceSchema": {
566
+ "type": "object",
567
+ "allOf": [
568
+ {
569
+ "properties": {
570
+ "directories": {
571
+ "type": "object",
572
+ "additionalProperties": false,
573
+ "patternProperties": {
574
+ ".+": {
575
+ "type": "object",
576
+ "allOf": [
577
+ {
578
+ "properties": {
579
+ "directories": {
580
+ "type": "object",
581
+ "additionalProperties": false,
582
+ "properties": {
583
+ "c": {
584
+ "description": "Each subdirectory is a card.",
585
+ "type": "object",
586
+ "properties": {
587
+ "directories": {
588
+ "type": "object",
589
+ "additionalProperties": false,
590
+ "patternProperties": {
591
+ "^[a-z]+_[0-9a-z]+$": {
592
+ "$ref": "#/$defs/cardDirectorySchema#"
593
+ }
594
+ }
595
+ },
596
+ "files": {
597
+ "type": "object",
598
+ "additionalProperties": false,
599
+ "properties": {
600
+ ".schema": {}
601
+ }
602
+ }
603
+ }
604
+ }
605
+ }
606
+ }
607
+ }
608
+ },
609
+ {
610
+ "properties": {
611
+ "files": {
612
+ "type": "object",
613
+ "additionalProperties": false,
614
+ "properties": {
615
+ ".gitkeep": {}
616
+ }
617
+ }
618
+ }
619
+ }
620
+ ]
621
+ }
622
+ }
623
+ }
624
+ }
625
+ },
626
+ {
627
+ "properties": {
628
+ "files": {
629
+ "$comment": "templates folder can contain template configuration files (<name>.json), content schema files (.schema) or .gitkeep",
630
+ "type": "object",
631
+ "additionalProperties": false,
632
+ "patternProperties": {
633
+ "^[A-Za-z0-9-_]+.json$": {
634
+ "type": "object",
635
+ "$comment": "Each file needs to be separately validated against 'contentSchema'",
636
+ "contentSchema": "templateSchema.json"
637
+ },
638
+ "^.schema$": {
639
+ "type": "object"
640
+ },
641
+ "^.gitkeep$": {
642
+ "type": "object"
643
+ }
644
+ }
645
+ }
646
+ }
647
+ },
648
+ {
649
+ "properties": {
650
+ "files": {
651
+ "type": "object",
652
+ "properties": {
653
+ ".schema": {},
654
+ ".gitkeep": {}
655
+ },
656
+ "required": [".schema"]
657
+ }
658
+ }
659
+ }
660
+ ]
661
+ }
662
+ }
663
+ }