@dmptool/types 1.2.3 → 1.2.4

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 (42) hide show
  1. package/README.md +8 -0
  2. package/dist/answers/__tests__/answers.spec.js +122 -6
  3. package/dist/answers/answer.d.ts +3 -3
  4. package/dist/answers/graphQLAnswers.d.ts +120 -25
  5. package/dist/answers/graphQLAnswers.js +22 -5
  6. package/dist/answers/index.d.ts +399 -31
  7. package/dist/answers/index.js +8 -2
  8. package/dist/answers/numberAnswers.d.ts +40 -0
  9. package/dist/answers/numberAnswers.js +8 -1
  10. package/dist/answers/tableAnswers.d.ts +1688 -75
  11. package/dist/answers/tableAnswers.js +63 -2
  12. package/dist/questions/__tests__/graphQLQuestions.spec.js +177 -39
  13. package/dist/questions/__tests__/numberQuestions.spec.js +36 -0
  14. package/dist/questions/__tests__/tableQuestion.spec.js +145 -0
  15. package/dist/questions/__tests__/usage.spec.js +162 -1
  16. package/dist/questions/graphQLQuestions.d.ts +420 -60
  17. package/dist/questions/graphQLQuestions.js +257 -11
  18. package/dist/questions/index.d.ts +4849 -189
  19. package/dist/questions/index.js +9 -2
  20. package/dist/questions/numberQuestions.d.ts +105 -0
  21. package/dist/questions/numberQuestions.js +12 -1
  22. package/dist/questions/question.d.ts +4 -4
  23. package/dist/questions/question.js +25 -4
  24. package/dist/questions/tableQuestions.d.ts +5930 -679
  25. package/dist/questions/tableQuestions.js +175 -3
  26. package/dist/schemas/anyAnswer.schema.json +137 -17
  27. package/dist/schemas/anyQuestion.schema.json +829 -101
  28. package/dist/schemas/anyTableColumnAnswer.schema.json +116 -5
  29. package/dist/schemas/anyTableColumnQuestion.schema.json +326 -24
  30. package/dist/schemas/licenseSearchAnswer.schema.json +49 -0
  31. package/dist/schemas/licenseSearchQuestion.schema.json +164 -0
  32. package/dist/schemas/metadataStandardSearchAnswer.schema.json +49 -0
  33. package/dist/schemas/metadataStandardSearchQuestion.schema.json +174 -0
  34. package/dist/schemas/numberWithContextAnswer.schema.json +45 -0
  35. package/dist/schemas/numberWithContextQuestion.schema.json +84 -0
  36. package/dist/schemas/repositorySearchAnswer.schema.json +49 -0
  37. package/dist/schemas/repositorySearchQuestion.schema.json +180 -0
  38. package/dist/schemas/researchOutputTableAnswer.schema.json +519 -0
  39. package/dist/schemas/researchOutputTableQuestion.schema.json +1183 -0
  40. package/dist/schemas/tableAnswer.schema.json +116 -5
  41. package/dist/schemas/tableQuestion.schema.json +348 -24
  42. package/package.json +9 -5
@@ -209,7 +209,7 @@
209
209
  "properties": {
210
210
  "type": {
211
211
  "type": "string",
212
- "const": "filteredSearch"
212
+ "const": "licenseSearch"
213
213
  },
214
214
  "meta": {
215
215
  "$ref": "#/definitions/TableAnswer/properties/meta"
@@ -217,11 +217,56 @@
217
217
  "answer": {
218
218
  "type": "array",
219
219
  "items": {
220
- "type": "string"
220
+ "type": "object",
221
+ "properties": {
222
+ "licenseId": {
223
+ "type": "string",
224
+ "default": ""
225
+ },
226
+ "licenseName": {
227
+ "type": "string",
228
+ "default": ""
229
+ }
230
+ },
231
+ "additionalProperties": false,
232
+ "default": {}
221
233
  },
222
- "default": [
223
- ""
224
- ]
234
+ "default": []
235
+ }
236
+ },
237
+ "required": [
238
+ "type"
239
+ ],
240
+ "additionalProperties": false
241
+ },
242
+ {
243
+ "type": "object",
244
+ "properties": {
245
+ "type": {
246
+ "type": "string",
247
+ "const": "metadataStandardSearch"
248
+ },
249
+ "meta": {
250
+ "$ref": "#/definitions/TableAnswer/properties/meta"
251
+ },
252
+ "answer": {
253
+ "type": "array",
254
+ "items": {
255
+ "type": "object",
256
+ "properties": {
257
+ "metadataStandardId": {
258
+ "type": "string",
259
+ "default": ""
260
+ },
261
+ "metadataStandardName": {
262
+ "type": "string",
263
+ "default": ""
264
+ }
265
+ },
266
+ "additionalProperties": false,
267
+ "default": {}
268
+ },
269
+ "default": []
225
270
  }
226
271
  },
227
272
  "required": [
@@ -274,6 +319,37 @@
274
319
  ],
275
320
  "additionalProperties": false
276
321
  },
322
+ {
323
+ "type": "object",
324
+ "properties": {
325
+ "type": {
326
+ "type": "string",
327
+ "const": "numberWithContext"
328
+ },
329
+ "meta": {
330
+ "$ref": "#/definitions/TableAnswer/properties/meta"
331
+ },
332
+ "answer": {
333
+ "type": "object",
334
+ "properties": {
335
+ "value": {
336
+ "type": "number",
337
+ "default": 0
338
+ },
339
+ "context": {
340
+ "type": "string",
341
+ "default": ""
342
+ }
343
+ },
344
+ "additionalProperties": false
345
+ }
346
+ },
347
+ "required": [
348
+ "type",
349
+ "answer"
350
+ ],
351
+ "additionalProperties": false
352
+ },
277
353
  {
278
354
  "type": "object",
279
355
  "properties": {
@@ -294,6 +370,41 @@
294
370
  ],
295
371
  "additionalProperties": false
296
372
  },
373
+ {
374
+ "type": "object",
375
+ "properties": {
376
+ "type": {
377
+ "type": "string",
378
+ "const": "repositorySearch"
379
+ },
380
+ "meta": {
381
+ "$ref": "#/definitions/TableAnswer/properties/meta"
382
+ },
383
+ "answer": {
384
+ "type": "array",
385
+ "items": {
386
+ "type": "object",
387
+ "properties": {
388
+ "repositoryId": {
389
+ "type": "string",
390
+ "default": ""
391
+ },
392
+ "repositoryName": {
393
+ "type": "string",
394
+ "default": ""
395
+ }
396
+ },
397
+ "additionalProperties": false,
398
+ "default": {}
399
+ },
400
+ "default": []
401
+ }
402
+ },
403
+ "required": [
404
+ "type"
405
+ ],
406
+ "additionalProperties": false
407
+ },
297
408
  {
298
409
  "type": "object",
299
410
  "properties": {
@@ -68,6 +68,14 @@
68
68
  "type": "string",
69
69
  "default": "Column A"
70
70
  },
71
+ "required": {
72
+ "type": "boolean",
73
+ "default": false
74
+ },
75
+ "enabled": {
76
+ "type": "boolean",
77
+ "default": true
78
+ },
71
79
  "content": {
72
80
  "anyOf": [
73
81
  {
@@ -489,26 +497,10 @@
489
497
  "properties": {
490
498
  "type": {
491
499
  "type": "string",
492
- "const": "filteredSearch"
500
+ "const": "licenseSearch"
493
501
  },
494
502
  "attributes": {
495
- "type": "object",
496
- "properties": {
497
- "label": {
498
- "$ref": "#/definitions/TableQuestion/properties/attributes/properties/label"
499
- },
500
- "help": {
501
- "$ref": "#/definitions/TableQuestion/properties/attributes/properties/help"
502
- },
503
- "labelTranslationKey": {
504
- "$ref": "#/definitions/TableQuestion/properties/attributes/properties/labelTranslationKey"
505
- },
506
- "multiple": {
507
- "type": "boolean",
508
- "default": true
509
- }
510
- },
511
- "additionalProperties": false,
503
+ "$ref": "#/definitions/TableQuestion/properties/columns/items/properties/content/anyOf/0/properties/attributes",
512
504
  "default": {}
513
505
  },
514
506
  "meta": {
@@ -537,18 +529,32 @@
537
529
  "additionalProperties": false
538
530
  },
539
531
  "default": [
540
- {}
532
+ {
533
+ "propertyName": "name",
534
+ "label": "Name"
535
+ },
536
+ {
537
+ "propertyName": "description",
538
+ "label": "Description"
539
+ },
540
+ {
541
+ "propertyName": "recommended",
542
+ "label": "Recommended"
543
+ }
541
544
  ]
542
545
  },
543
546
  "localQueryId": {
544
547
  "$ref": "#/definitions/TableQuestion/properties/columns/items/properties/content/anyOf/0/properties/graphQL/properties/localQueryId"
545
548
  },
546
549
  "query": {
547
- "type": "string"
550
+ "type": "string",
551
+ "const": "query Licenses($term: String, $paginationOptions: PaginationOptions){ license(term: $term, paginationOptions: $paginationOptions) { totalCount currentOffset limit hasNextPage hasPreviousPage availableSortFields items { id name uri description } } }",
552
+ "default": "query Licenses($term: String, $paginationOptions: PaginationOptions){ license(term: $term, paginationOptions: $paginationOptions) { totalCount currentOffset limit hasNextPage hasPreviousPage availableSortFields items { id name uri description } } }"
548
553
  },
549
554
  "responseField": {
550
555
  "type": "string",
551
- "default": "query.items"
556
+ "const": "licenses.items",
557
+ "default": "licenses.items"
552
558
  },
553
559
  "variables": {
554
560
  "type": "array",
@@ -579,8 +585,139 @@
579
585
  "additionalProperties": false
580
586
  },
581
587
  "default": [
582
- {}
588
+ {
589
+ "minLength": 3,
590
+ "label": "Search for a license",
591
+ "name": "term",
592
+ "type": "string"
593
+ },
594
+ {
595
+ "label": "Pagination Options",
596
+ "name": "paginationOptions",
597
+ "type": "paginationOptions",
598
+ "options": {
599
+ "type": "OFFSET",
600
+ "limit": 10,
601
+ "offset": 0,
602
+ "sortField": "name",
603
+ "sortOrder": "ASC"
604
+ }
605
+ }
606
+ ]
607
+ },
608
+ "queryId": {
609
+ "type": "string",
610
+ "default": "useLicensesQuery"
611
+ },
612
+ "answerField": {
613
+ "type": "string",
614
+ "const": "uri",
615
+ "default": "uri"
616
+ }
617
+ },
618
+ "additionalProperties": false,
619
+ "default": {}
620
+ }
621
+ },
622
+ "required": [
623
+ "type"
624
+ ],
625
+ "additionalProperties": false
626
+ },
627
+ {
628
+ "type": "object",
629
+ "properties": {
630
+ "type": {
631
+ "type": "string",
632
+ "const": "metadataStandardSearch"
633
+ },
634
+ "attributes": {
635
+ "$ref": "#/definitions/TableQuestion/properties/columns/items/properties/content/anyOf/0/properties/attributes",
636
+ "default": {}
637
+ },
638
+ "meta": {
639
+ "$ref": "#/definitions/TableQuestion/properties/meta"
640
+ },
641
+ "graphQL": {
642
+ "type": "object",
643
+ "properties": {
644
+ "displayFields": {
645
+ "type": "array",
646
+ "items": {
647
+ "$ref": "#/definitions/TableQuestion/properties/columns/items/properties/content/anyOf/7/properties/graphQL/properties/displayFields/items"
648
+ },
649
+ "default": [
650
+ {
651
+ "propertyName": "name",
652
+ "label": "Name"
653
+ },
654
+ {
655
+ "propertyName": "description",
656
+ "label": "Description"
657
+ },
658
+ {
659
+ "propertyName": "website",
660
+ "label": "Website"
661
+ },
662
+ {
663
+ "propertyName": "keywords",
664
+ "label": "Subject Areas"
665
+ }
583
666
  ]
667
+ },
668
+ "localQueryId": {
669
+ "$ref": "#/definitions/TableQuestion/properties/columns/items/properties/content/anyOf/0/properties/graphQL/properties/localQueryId"
670
+ },
671
+ "query": {
672
+ "type": "string",
673
+ "const": "query MetadataStandards($term: String, $keywords: [String!], $paginationOptions: PaginationOptions){ metadataStandards(term: $term, keywords: $keywords, paginationOptions: $paginationOptions) { totalCount currentOffset limit hasNextPage hasPreviousPage availableSortFields items { id name uri description keywords } } }",
674
+ "default": "query MetadataStandards($term: String, $keywords: [String!], $paginationOptions: PaginationOptions){ metadataStandards(term: $term, keywords: $keywords, paginationOptions: $paginationOptions) { totalCount currentOffset limit hasNextPage hasPreviousPage availableSortFields items { id name uri description keywords } } }"
675
+ },
676
+ "responseField": {
677
+ "type": "string",
678
+ "const": "metadataStandards.items",
679
+ "default": "metadataStandards.items"
680
+ },
681
+ "variables": {
682
+ "type": "array",
683
+ "items": {
684
+ "$ref": "#/definitions/TableQuestion/properties/columns/items/properties/content/anyOf/7/properties/graphQL/properties/variables/items"
685
+ },
686
+ "default": [
687
+ {
688
+ "minLength": 3,
689
+ "label": "Search for a metadata standard",
690
+ "name": "term",
691
+ "type": "string"
692
+ },
693
+ {
694
+ "minLength": 3,
695
+ "label": "Subject Areas",
696
+ "name": "keywords",
697
+ "type": "string"
698
+ },
699
+ {
700
+ "label": "Pagination Options",
701
+ "name": "paginationOptions",
702
+ "type": "paginationOptions",
703
+ "options": {
704
+ "type": "OFFSET",
705
+ "limit": 10,
706
+ "offset": 0,
707
+ "sortField": "name",
708
+ "sortOrder": "ASC"
709
+ }
710
+ }
711
+ ]
712
+ },
713
+ "queryId": {
714
+ "type": "string",
715
+ "default": "useMetadataStandardsQuery"
716
+ },
717
+ "answerField": {
718
+ "type": "string",
719
+ "const": "uri",
720
+ "default": "uri"
584
721
  }
585
722
  },
586
723
  "additionalProperties": false,
@@ -633,6 +770,68 @@
633
770
  ],
634
771
  "additionalProperties": false
635
772
  },
773
+ {
774
+ "type": "object",
775
+ "properties": {
776
+ "type": {
777
+ "type": "string",
778
+ "const": "numberWithContext"
779
+ },
780
+ "attributes": {
781
+ "type": "object",
782
+ "properties": {
783
+ "label": {
784
+ "$ref": "#/definitions/TableQuestion/properties/attributes/properties/label"
785
+ },
786
+ "help": {
787
+ "$ref": "#/definitions/TableQuestion/properties/attributes/properties/help"
788
+ },
789
+ "labelTranslationKey": {
790
+ "$ref": "#/definitions/TableQuestion/properties/attributes/properties/labelTranslationKey"
791
+ },
792
+ "max": {
793
+ "$ref": "#/definitions/TableQuestion/properties/columns/items/properties/content/anyOf/3/properties/attributes/properties/max"
794
+ },
795
+ "min": {
796
+ "$ref": "#/definitions/TableQuestion/properties/columns/items/properties/content/anyOf/3/properties/attributes/properties/min"
797
+ },
798
+ "step": {
799
+ "$ref": "#/definitions/TableQuestion/properties/columns/items/properties/content/anyOf/3/properties/attributes/properties/step"
800
+ },
801
+ "context": {
802
+ "type": "array",
803
+ "items": {
804
+ "type": "object",
805
+ "properties": {
806
+ "label": {
807
+ "type": "string",
808
+ "default": ""
809
+ },
810
+ "labelTranslationKey": {
811
+ "type": "string"
812
+ },
813
+ "value": {
814
+ "type": "string",
815
+ "default": ""
816
+ }
817
+ },
818
+ "additionalProperties": false
819
+ },
820
+ "default": []
821
+ }
822
+ },
823
+ "additionalProperties": false,
824
+ "default": {}
825
+ },
826
+ "meta": {
827
+ "$ref": "#/definitions/TableQuestion/properties/meta"
828
+ }
829
+ },
830
+ "required": [
831
+ "type"
832
+ ],
833
+ "additionalProperties": false
834
+ },
636
835
  {
637
836
  "type": "object",
638
837
  "properties": {
@@ -675,6 +874,117 @@
675
874
  ],
676
875
  "additionalProperties": false
677
876
  },
877
+ {
878
+ "type": "object",
879
+ "properties": {
880
+ "type": {
881
+ "type": "string",
882
+ "const": "repositorySearch"
883
+ },
884
+ "attributes": {
885
+ "$ref": "#/definitions/TableQuestion/properties/columns/items/properties/content/anyOf/0/properties/attributes",
886
+ "default": {}
887
+ },
888
+ "meta": {
889
+ "$ref": "#/definitions/TableQuestion/properties/meta"
890
+ },
891
+ "graphQL": {
892
+ "type": "object",
893
+ "properties": {
894
+ "displayFields": {
895
+ "type": "array",
896
+ "items": {
897
+ "$ref": "#/definitions/TableQuestion/properties/columns/items/properties/content/anyOf/7/properties/graphQL/properties/displayFields/items"
898
+ },
899
+ "default": [
900
+ {
901
+ "propertyName": "name",
902
+ "label": "Name"
903
+ },
904
+ {
905
+ "propertyName": "description",
906
+ "label": "Description"
907
+ },
908
+ {
909
+ "propertyName": "website",
910
+ "label": "Website"
911
+ },
912
+ {
913
+ "propertyName": "keywords",
914
+ "label": "Subject Areas"
915
+ }
916
+ ]
917
+ },
918
+ "localQueryId": {
919
+ "$ref": "#/definitions/TableQuestion/properties/columns/items/properties/content/anyOf/0/properties/graphQL/properties/localQueryId"
920
+ },
921
+ "query": {
922
+ "type": "string",
923
+ "const": "query Repositories($term: String, $keywords: [String!], $repositoryType: String, $paginationOptions: PaginationOptions){ repositories(term: $term, keywords: $keywords, repositoryType: $repositoryType, paginationOptions: $paginationOptions) { totalCount currentOffset limit hasNextPage hasPreviousPage availableSortFields items { id name uri description website keywords repositoryTypes } } }",
924
+ "default": "query Repositories($term: String, $keywords: [String!], $repositoryType: String, $paginationOptions: PaginationOptions){ repositories(term: $term, keywords: $keywords, repositoryType: $repositoryType, paginationOptions: $paginationOptions) { totalCount currentOffset limit hasNextPage hasPreviousPage availableSortFields items { id name uri description website keywords repositoryTypes } } }"
925
+ },
926
+ "responseField": {
927
+ "type": "string",
928
+ "const": "repositories.items",
929
+ "default": "repositories.items"
930
+ },
931
+ "variables": {
932
+ "type": "array",
933
+ "items": {
934
+ "$ref": "#/definitions/TableQuestion/properties/columns/items/properties/content/anyOf/7/properties/graphQL/properties/variables/items"
935
+ },
936
+ "default": [
937
+ {
938
+ "minLength": 3,
939
+ "label": "Search for a repository",
940
+ "name": "term",
941
+ "type": "string"
942
+ },
943
+ {
944
+ "minLength": 3,
945
+ "label": "Subject Areas",
946
+ "name": "keywords",
947
+ "type": "string"
948
+ },
949
+ {
950
+ "minLength": 3,
951
+ "label": "Repository type",
952
+ "name": "repositoryType",
953
+ "type": "string"
954
+ },
955
+ {
956
+ "label": "Pagination Options",
957
+ "name": "paginationOptions",
958
+ "type": "paginationOptions",
959
+ "options": {
960
+ "type": "OFFSET",
961
+ "limit": 10,
962
+ "offset": 0,
963
+ "sortField": "name",
964
+ "sortOrder": "ASC"
965
+ }
966
+ }
967
+ ]
968
+ },
969
+ "queryId": {
970
+ "type": "string",
971
+ "default": "useRepositoriesQuery"
972
+ },
973
+ "answerField": {
974
+ "type": "string",
975
+ "const": "uri",
976
+ "default": "uri"
977
+ }
978
+ },
979
+ "additionalProperties": false,
980
+ "default": {}
981
+ }
982
+ },
983
+ "required": [
984
+ "type"
985
+ ],
986
+ "additionalProperties": false
987
+ },
678
988
  {
679
989
  "type": "object",
680
990
  "properties": {
@@ -713,7 +1023,7 @@
713
1023
  "options": {
714
1024
  "type": "array",
715
1025
  "items": {
716
- "$ref": "#/definitions/TableQuestion/properties/columns/items/properties/content/anyOf/9/properties/options/items"
1026
+ "$ref": "#/definitions/TableQuestion/properties/columns/items/properties/content/anyOf/11/properties/options/items"
717
1027
  },
718
1028
  "default": [
719
1029
  {}
@@ -824,7 +1134,7 @@
824
1134
  "const": "url"
825
1135
  },
826
1136
  "attributes": {
827
- "$ref": "#/definitions/TableQuestion/properties/columns/items/properties/content/anyOf/12/properties/attributes",
1137
+ "$ref": "#/definitions/TableQuestion/properties/columns/items/properties/content/anyOf/15/properties/attributes",
828
1138
  "default": {}
829
1139
  },
830
1140
  "meta": {
@@ -840,6 +1150,20 @@
840
1150
  "default": {
841
1151
  "type": "textArea"
842
1152
  }
1153
+ },
1154
+ "meta": {
1155
+ "type": "object",
1156
+ "properties": {
1157
+ "schemaVersion": {
1158
+ "type": "string",
1159
+ "default": "1.0"
1160
+ },
1161
+ "labelTranslationKey": {
1162
+ "type": "string"
1163
+ }
1164
+ },
1165
+ "additionalProperties": false,
1166
+ "default": {}
843
1167
  }
844
1168
  },
845
1169
  "additionalProperties": false
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dmptool/types",
3
- "version": "1.2.3",
3
+ "version": "1.2.4",
4
4
  "description": "TypeScript types for DMPTool",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -25,12 +25,15 @@
25
25
  "generate": "ts-node scripts/generateSchemas.ts",
26
26
  "lint": "eslint . --ignore-pattern dist/ --ignore-pattern node_modules/",
27
27
  "prepublishOnly": "npm run build",
28
- "test": "jest --config jest.config.ts"
28
+ "test": "jest --config jest.config.ts",
29
+ "prepare": "husky",
30
+ "type-check": "tsc --noEmit",
31
+ "trivy-high": "./scripts/trivy-high.sh",
32
+ "trivy-med": "./scripts/trivy-med.sh"
29
33
  },
30
34
  "dependencies": {
31
- "fs": "^0.0.1-security",
32
- "zod": "^3.24.4",
33
- "zod-to-json-schema": "^3.24.5"
35
+ "zod": "3.24.4",
36
+ "zod-to-json-schema": "3.24.5"
34
37
  },
35
38
  "devDependencies": {
36
39
  "@eslint/js": "^9.26.0",
@@ -38,6 +41,7 @@
38
41
  "@types/node": "^20.4.3",
39
42
  "cpy": "^11.1.0",
40
43
  "eslint": "^9.26.0",
44
+ "husky": "^9.1.7",
41
45
  "jest": "^29.7.0",
42
46
  "ts-jest": "^29.3.3",
43
47
  "ts-node": "^10.9.2",