@dmptool/types 1.1.2 → 1.1.3

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 (37) hide show
  1. package/dist/questions/__tests__/graphQLQuestions.spec.js +6 -4
  2. package/dist/questions/__tests__/optionBasedQuestions.spec.js +4 -12
  3. package/dist/questions/dateQuestions.d.ts +31 -41
  4. package/dist/questions/dateQuestions.js +5 -20
  5. package/dist/questions/graphQLQuestions.d.ts +75 -81
  6. package/dist/questions/graphQLQuestions.js +18 -24
  7. package/dist/questions/index.d.ts +524 -723
  8. package/dist/questions/numberQuestions.d.ts +51 -66
  9. package/dist/questions/numberQuestions.js +6 -28
  10. package/dist/questions/optionBasedQuestions.d.ts +44 -69
  11. package/dist/questions/optionBasedQuestions.js +7 -55
  12. package/dist/questions/question.d.ts +0 -8
  13. package/dist/questions/question.js +0 -1
  14. package/dist/questions/tableQuestions.d.ts +717 -998
  15. package/dist/questions/tableQuestions.js +3 -10
  16. package/dist/questions/textQuestions.d.ts +21 -41
  17. package/dist/questions/textQuestions.js +10 -34
  18. package/dist/schemas/affiliationSearchQuestion.schema.json +39 -26
  19. package/dist/schemas/anyQuestion.schema.json +152 -119
  20. package/dist/schemas/anyTableColumnQuestion.schema.json +142 -104
  21. package/dist/schemas/booleanQuestion.schema.json +2 -5
  22. package/dist/schemas/checkboxesQuestion.schema.json +6 -11
  23. package/dist/schemas/currencyQuestion.schema.json +6 -7
  24. package/dist/schemas/dateQuestion.schema.json +2 -5
  25. package/dist/schemas/dateRangeQuestion.schema.json +6 -5
  26. package/dist/schemas/emailQuestion.schema.json +4 -6
  27. package/dist/schemas/filteredSearchQuestion.schema.json +0 -3
  28. package/dist/schemas/multiselectBoxQuestion.schema.json +6 -11
  29. package/dist/schemas/numberQuestion.schema.json +4 -6
  30. package/dist/schemas/numberRangeQuestion.schema.json +8 -6
  31. package/dist/schemas/radioButtonsQuestion.schema.json +6 -11
  32. package/dist/schemas/selectBoxQuestion.schema.json +7 -15
  33. package/dist/schemas/tableQuestion.schema.json +148 -111
  34. package/dist/schemas/textAreaQuestion.schema.json +6 -7
  35. package/dist/schemas/textQuestion.schema.json +2 -5
  36. package/dist/schemas/urlQuestion.schema.json +2 -5
  37. package/package.json +1 -1
@@ -39,10 +39,6 @@
39
39
  "usageDescription": {
40
40
  "type": "string",
41
41
  "const": "For questions that require the user to select from a controlled list of institutions."
42
- },
43
- "defaultJSON": {
44
- "type": "string",
45
- "const": "{\"type\":\"affiliationSearch\",\"attributes\":{},\"meta\":{\"schemaVersion\":\"1.0\"},\"graphQL\":{\"query\":\"query Affiliations($name: String!){affiliations(name: $name) { totalCount nextCursor items {id displayName uri}}}\",\"queryId\":\"useAffiliationsQuery\",\"variables\":[{\"name\":\"term\",\"type\":\"string\",\"label\":\"Search for your institution\",\"minLength\":3,\"labelTranslationKey\":\"SignupPage.institutionHelp\"}],\"answerField\":\"uri\",\"displayFields\":[{\"label\":\"Institution\",\"propertyName\":\"displayName\",\"labelTranslationKey\":\"SignupPage.institution\"}],\"responseField\":\"affiliations.items\"}}"
46
42
  }
47
43
  },
48
44
  "required": [
@@ -59,18 +55,20 @@
59
55
  "type": "object",
60
56
  "properties": {
61
57
  "propertyName": {
62
- "type": "string"
58
+ "type": "string",
59
+ "const": "displayName"
63
60
  },
64
61
  "label": {
65
- "type": "string"
62
+ "type": "string",
63
+ "default": "Institution"
66
64
  },
67
65
  "labelTranslationKey": {
68
- "type": "string"
66
+ "type": "string",
67
+ "default": "SignupPage.institution"
69
68
  }
70
69
  },
71
70
  "required": [
72
- "propertyName",
73
- "label"
71
+ "propertyName"
74
72
  ],
75
73
  "additionalProperties": false
76
74
  }
@@ -79,46 +77,61 @@
79
77
  "type": "string"
80
78
  },
81
79
  "query": {
82
- "type": "string"
80
+ "type": "string",
81
+ "const": "query Affiliations($name: String!){affiliations(name: $name) { totalCount nextCursor items {id displayName uri}}}"
83
82
  },
84
83
  "responseField": {
85
- "type": "string"
84
+ "type": "string",
85
+ "const": "affiliations.items"
86
86
  },
87
87
  "variables": {
88
88
  "type": "array",
89
89
  "items": {
90
90
  "type": "object",
91
91
  "properties": {
92
- "minLength": {
93
- "type": "number"
94
- },
95
- "label": {
96
- "type": "string"
97
- },
98
- "labelTranslationKey": {
99
- "type": "string"
100
- },
101
92
  "name": {
102
- "type": "string"
93
+ "type": "string",
94
+ "const": "name"
103
95
  },
104
96
  "type": {
105
- "type": "string"
97
+ "type": "string",
98
+ "default": "string"
106
99
  },
107
- "defaultValue": {
108
- "type": "string"
100
+ "label": {
101
+ "type": "string",
102
+ "default": "Search for your institution"
103
+ },
104
+ "minLength": {
105
+ "type": "number",
106
+ "const": 3
107
+ },
108
+ "labelTranslationKey": {
109
+ "type": "string",
110
+ "default": "SignupPage.institutionHelp"
109
111
  }
110
112
  },
111
113
  "required": [
112
114
  "name",
113
- "type"
115
+ "minLength"
114
116
  ],
115
117
  "additionalProperties": false
116
118
  }
119
+ },
120
+ "queryId": {
121
+ "type": "string",
122
+ "default": "useAffiliationsQuery"
123
+ },
124
+ "answerField": {
125
+ "type": "string",
126
+ "const": "uri"
117
127
  }
118
128
  },
119
129
  "required": [
120
130
  "displayFields",
121
- "responseField"
131
+ "query",
132
+ "responseField",
133
+ "variables",
134
+ "answerField"
122
135
  ],
123
136
  "additionalProperties": false
124
137
  }
@@ -150,7 +163,8 @@
150
163
  "$ref": "#/definitions/AnyQuestion/anyOf/0/properties/attributes/properties/labelTranslationKey"
151
164
  },
152
165
  "checked": {
153
- "type": "boolean"
166
+ "type": "boolean",
167
+ "default": false
154
168
  }
155
169
  },
156
170
  "additionalProperties": false
@@ -168,10 +182,6 @@
168
182
  "usageDescription": {
169
183
  "type": "string",
170
184
  "const": "For questions that require a simple Yes/No response."
171
- },
172
- "defaultJSON": {
173
- "type": "string",
174
- "const": "{\n \"attributes\": {\n \"checked\": false\n },\n \"meta\": {\n \"schemaVersion\": \"1.0\"\n }\n}"
175
185
  }
176
186
  },
177
187
  "required": [
@@ -208,10 +218,6 @@
208
218
  "usageDescription": {
209
219
  "type": "string",
210
220
  "const": "For multiple choice questions where users can select multiple options."
211
- },
212
- "defaultJSON": {
213
- "type": "string",
214
- "const": "{\n \"type\": \"checkBoxes\",\n \"attributes\": {},\n \"options\": [\n {\n \"label\": \"Option 1\",\n \"value\": \"1\",\n \"checked\": false\n }\n ],\n \"meta\": {\n \"schemaVersion\": \"1.0\"\n }\n}"
215
221
  }
216
222
  },
217
223
  "required": [
@@ -225,19 +231,18 @@
225
231
  "type": "object",
226
232
  "properties": {
227
233
  "label": {
228
- "type": "string"
234
+ "type": "string",
235
+ "default": "Option A"
229
236
  },
230
237
  "value": {
231
- "type": "string"
238
+ "type": "string",
239
+ "default": "a"
232
240
  },
233
241
  "checked": {
234
- "type": "boolean"
242
+ "type": "boolean",
243
+ "default": false
235
244
  }
236
245
  },
237
- "required": [
238
- "label",
239
- "value"
240
- ],
241
246
  "additionalProperties": false
242
247
  }
243
248
  }
@@ -271,13 +276,16 @@
271
276
  "type": "number"
272
277
  },
273
278
  "min": {
274
- "type": "number"
279
+ "type": "number",
280
+ "default": 0
275
281
  },
276
282
  "step": {
277
- "type": "number"
283
+ "type": "number",
284
+ "default": 1
278
285
  },
279
286
  "denomination": {
280
- "type": "string"
287
+ "type": "string",
288
+ "default": "USD"
281
289
  }
282
290
  },
283
291
  "additionalProperties": false
@@ -295,10 +303,6 @@
295
303
  "usageDescription": {
296
304
  "type": "string",
297
305
  "const": "For questions that require a monetary amount (e.g. Cost or Budget)."
298
- },
299
- "defaultJSON": {
300
- "type": "string",
301
- "const": "{\n \"type\": \"currency\",\n \"attributes\": {\n \"denomination\": \"USD\",\n \"min\": 0,\n \"step\": 1\n },\n \"meta\": {\n \"schemaVersion\": \"1.0\"\n }\n}"
302
306
  }
303
307
  },
304
308
  "required": [
@@ -338,7 +342,8 @@
338
342
  "type": "string"
339
343
  },
340
344
  "step": {
341
- "type": "number"
345
+ "type": "number",
346
+ "default": 1
342
347
  }
343
348
  },
344
349
  "additionalProperties": false
@@ -356,10 +361,6 @@
356
361
  "usageDescription": {
357
362
  "type": "string",
358
363
  "const": "For questions that require a date."
359
- },
360
- "defaultJSON": {
361
- "type": "string",
362
- "const": "{\"type\":\"date\",\"attributes\":{\"step\":1},\"meta\":{\"schemaVersion\":\"1.0\"}}"
363
364
  }
364
365
  },
365
366
  "required": [
@@ -396,10 +397,6 @@
396
397
  "usageDescription": {
397
398
  "type": "string",
398
399
  "const": "For questions that require a date range (e.g. From/To, Start/End)"
399
- },
400
- "defaultJSON": {
401
- "type": "string",
402
- "const": "{\"type\":\"dateRange\",\"attributes\":{},\"columns\":{\"start\":{\"label\":\"Start\",\"step\":1},\"end\":{\"label\":\"End\",\"step\":1}}}"
403
400
  }
404
401
  },
405
402
  "required": [
@@ -417,6 +414,10 @@
417
414
  "$ref": "#/definitions/AnyQuestion/anyOf/4/properties/attributes"
418
415
  }
419
416
  },
417
+ "required": [
418
+ "start",
419
+ "end"
420
+ ],
420
421
  "additionalProperties": false
421
422
  }
422
423
  },
@@ -446,7 +447,8 @@
446
447
  "$ref": "#/definitions/AnyQuestion/anyOf/0/properties/attributes/properties/labelTranslationKey"
447
448
  },
448
449
  "maxLength": {
449
- "type": "number"
450
+ "type": "number",
451
+ "default": 255
450
452
  },
451
453
  "minLength": {
452
454
  "type": "number"
@@ -455,7 +457,8 @@
455
457
  "type": "string"
456
458
  },
457
459
  "multiple": {
458
- "type": "boolean"
460
+ "type": "boolean",
461
+ "default": false
459
462
  }
460
463
  },
461
464
  "additionalProperties": false
@@ -473,10 +476,6 @@
473
476
  "usageDescription": {
474
477
  "type": "string",
475
478
  "const": "For questions that require require email address(es)."
476
- },
477
- "defaultJSON": {
478
- "type": "string",
479
- "const": "{\"type\":\"email\",\"attributes\":{\"maxLength\":255,\"minLength\":1,\"multiple\":false},\"meta\":{\"schemaVersion\":\"1.0\"}}"
480
479
  }
481
480
  },
482
481
  "required": [
@@ -527,9 +526,6 @@
527
526
  },
528
527
  "usageDescription": {
529
528
  "type": "string"
530
- },
531
- "defaultJSON": {
532
- "type": "string"
533
529
  }
534
530
  },
535
531
  "required": [
@@ -538,7 +534,76 @@
538
534
  "additionalProperties": false
539
535
  },
540
536
  "graphQL": {
541
- "$ref": "#/definitions/AnyQuestion/anyOf/0/properties/graphQL"
537
+ "type": "object",
538
+ "properties": {
539
+ "displayFields": {
540
+ "type": "array",
541
+ "items": {
542
+ "type": "object",
543
+ "properties": {
544
+ "propertyName": {
545
+ "type": "string"
546
+ },
547
+ "label": {
548
+ "type": "string"
549
+ },
550
+ "labelTranslationKey": {
551
+ "type": "string"
552
+ }
553
+ },
554
+ "required": [
555
+ "propertyName",
556
+ "label"
557
+ ],
558
+ "additionalProperties": false
559
+ }
560
+ },
561
+ "localQueryId": {
562
+ "$ref": "#/definitions/AnyQuestion/anyOf/0/properties/graphQL/properties/localQueryId"
563
+ },
564
+ "query": {
565
+ "type": "string"
566
+ },
567
+ "responseField": {
568
+ "type": "string"
569
+ },
570
+ "variables": {
571
+ "type": "array",
572
+ "items": {
573
+ "type": "object",
574
+ "properties": {
575
+ "minLength": {
576
+ "type": "number"
577
+ },
578
+ "label": {
579
+ "type": "string"
580
+ },
581
+ "labelTranslationKey": {
582
+ "type": "string"
583
+ },
584
+ "name": {
585
+ "type": "string"
586
+ },
587
+ "type": {
588
+ "type": "string"
589
+ },
590
+ "defaultValue": {
591
+ "type": "string"
592
+ }
593
+ },
594
+ "required": [
595
+ "name",
596
+ "type"
597
+ ],
598
+ "additionalProperties": false
599
+ }
600
+ }
601
+ },
602
+ "required": [
603
+ "displayFields",
604
+ "responseField"
605
+ ],
606
+ "additionalProperties": false
542
607
  }
543
608
  },
544
609
  "required": [
@@ -589,10 +654,6 @@
589
654
  "usageDescription": {
590
655
  "type": "string",
591
656
  "const": "For questions where multiple answers are valid. Allows users to select several options from a predefined list, providing flexibility in responses."
592
- },
593
- "defaultJSON": {
594
- "type": "string",
595
- "const": "{\n \"type\": \"selectBox\",\n \"attributes\": {\n \"multiple\": true\n },\n \"options\": [\n {\n \"label\": \"Option 1\",\n \"value\": \"option1\"\n }\n ],\n \"meta\": {\n \"schemaVersion\": \"1.0\"\n }\n}"
596
657
  }
597
658
  },
598
659
  "required": [
@@ -612,13 +673,10 @@
612
673
  "$ref": "#/definitions/AnyQuestion/anyOf/2/properties/options/items/properties/value"
613
674
  },
614
675
  "selected": {
615
- "type": "boolean"
676
+ "type": "boolean",
677
+ "default": false
616
678
  }
617
679
  },
618
- "required": [
619
- "label",
620
- "value"
621
- ],
622
680
  "additionalProperties": false
623
681
  }
624
682
  }
@@ -674,10 +732,6 @@
674
732
  "usageDescription": {
675
733
  "type": "string",
676
734
  "const": "For questions that require a single numeric value."
677
- },
678
- "defaultJSON": {
679
- "type": "string",
680
- "const": "{\n \"type\": \"number\",\n \"attributes\": {\n \"min\": 0,\n \"step\": 1\n },\n \"meta\": {\n \"schemaVersion\": \"1.0\"\n }\n}"
681
735
  }
682
736
  },
683
737
  "required": [
@@ -714,10 +768,6 @@
714
768
  "usageDescription": {
715
769
  "type": "string",
716
770
  "const": "For questions that require a numerical range (e.g. From/To, Min/Max)."
717
- },
718
- "defaultJSON": {
719
- "type": "string",
720
- "const": "{\n \"type\": \"numberRange\",\n \"attributes\": {},\n \"columns\": {\n \"start\": {\n \"label\": \"From\",\n \"min\": 0,\n \"step\": 1\n },\n \"end\": {\n \"label\": \"To\",\n \"min\": 0,\n \"step\": 1\n }\n },\n \"meta\": {\n \"schemaVersion\": \"1.0\"\n }\n}"
721
771
  }
722
772
  },
723
773
  "required": [
@@ -735,6 +785,10 @@
735
785
  "$ref": "#/definitions/AnyQuestion/anyOf/9/properties/attributes"
736
786
  }
737
787
  },
788
+ "required": [
789
+ "start",
790
+ "end"
791
+ ],
738
792
  "additionalProperties": false
739
793
  }
740
794
  },
@@ -767,10 +821,6 @@
767
821
  "usageDescription": {
768
822
  "type": "string",
769
823
  "const": "For multiple choice questions where users select just one option."
770
- },
771
- "defaultJSON": {
772
- "type": "string",
773
- "const": "{\n \"type\": \"radioButtons\",\n \"attributes\": {},\n \"options\": [\n {\n \"label\": \"Option 1\",\n \"value\": \"option1\",\n \"selected\": false\n }\n ],\n \"meta\": {\n \"schemaVersion\": \"1.0\"\n }\n}"
774
824
  }
775
825
  },
776
826
  "required": [
@@ -812,12 +862,9 @@
812
862
  },
813
863
  "multiple": {
814
864
  "type": "boolean",
815
- "const": false
865
+ "default": false
816
866
  }
817
867
  },
818
- "required": [
819
- "multiple"
820
- ],
821
868
  "additionalProperties": false
822
869
  },
823
870
  "meta": {
@@ -833,10 +880,6 @@
833
880
  "usageDescription": {
834
881
  "type": "string",
835
882
  "const": "For questions where users select one option from a list."
836
- },
837
- "defaultJSON": {
838
- "type": "string",
839
- "const": "{\n \"type\": \"selectBox\",\n \"attributes\": {\n \"multiple\": false\n },\n \"options\": [\n {\n \"label\": \"Option 1\",\n \"value\": \"option1\"\n }\n ],\n \"meta\": {\n \"schemaVersion\": \"1.0\"\n }\n}"
840
883
  }
841
884
  },
842
885
  "required": [
@@ -875,13 +918,16 @@
875
918
  "$ref": "#/definitions/AnyQuestion/anyOf/0/properties/attributes/properties/labelTranslationKey"
876
919
  },
877
920
  "canAddRows": {
878
- "type": "boolean"
921
+ "type": "boolean",
922
+ "default": true
879
923
  },
880
924
  "canRemoveRows": {
881
- "type": "boolean"
925
+ "type": "boolean",
926
+ "default": true
882
927
  },
883
928
  "initialRows": {
884
- "type": "number"
929
+ "type": "number",
930
+ "default": 1
885
931
  },
886
932
  "maxRows": {
887
933
  "type": "number"
@@ -905,10 +951,6 @@
905
951
  "usageDescription": {
906
952
  "type": "string",
907
953
  "const": "For questions that require a tabular format."
908
- },
909
- "defaultJSON": {
910
- "type": "string",
911
- "const": "{\"type\":\"table\",\"columns\":[],\"attributes\":{\"canAddRows\":true,\"canRemoveRows\":true,\"initialRows\":1},\"meta\":{\"schemaVersion\":\"1.0\"}}"
912
954
  }
913
955
  },
914
956
  "required": [
@@ -979,7 +1021,8 @@
979
1021
  "$ref": "#/definitions/AnyQuestion/anyOf/0/properties/attributes/properties/labelTranslationKey"
980
1022
  },
981
1023
  "cols": {
982
- "type": "number"
1024
+ "type": "number",
1025
+ "default": 20
983
1026
  },
984
1027
  "maxLength": {
985
1028
  "type": "number"
@@ -988,10 +1031,12 @@
988
1031
  "type": "number"
989
1032
  },
990
1033
  "rows": {
991
- "type": "number"
1034
+ "type": "number",
1035
+ "default": 2
992
1036
  },
993
1037
  "asRichText": {
994
- "type": "boolean"
1038
+ "type": "boolean",
1039
+ "default": true
995
1040
  }
996
1041
  },
997
1042
  "additionalProperties": false
@@ -1009,10 +1054,6 @@
1009
1054
  "usageDescription": {
1010
1055
  "type": "string",
1011
1056
  "const": "For questions that require longer answers, you can select formatting options too."
1012
- },
1013
- "defaultJSON": {
1014
- "type": "string",
1015
- "const": "{\"type\":\"textArea\",\"attributes\":{\"cols\":20,\"rows\":2,\"asRichText\":true},\"meta\":{\"schemaVersion\":\"1.0\"}}"
1016
1057
  }
1017
1058
  },
1018
1059
  "required": [
@@ -1070,10 +1111,6 @@
1070
1111
  "usageDescription": {
1071
1112
  "type": "string",
1072
1113
  "const": "For questions that require short, simple answers."
1073
- },
1074
- "defaultJSON": {
1075
- "type": "string",
1076
- "const": "{\"type\":\"text\",\"attributes\":{\"maxLength\":255},\"meta\":{\"schemaVersion\":\"1.0\"}}"
1077
1114
  }
1078
1115
  },
1079
1116
  "required": [
@@ -1110,10 +1147,6 @@
1110
1147
  "usageDescription": {
1111
1148
  "type": "string",
1112
1149
  "const": "For questions that require a website, DOI or other URL."
1113
- },
1114
- "defaultJSON": {
1115
- "type": "string",
1116
- "const": "{\"type\":\"url\",\"attributes\":{\"maxLength\":255},\"meta\":{\"schemaVersion\":\"1.0\"}}"
1117
1150
  }
1118
1151
  },
1119
1152
  "required": [