@dmptool/types 1.2.3 → 1.2.5

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 +188 -3
  26. package/dist/schemas/anyAnswer.schema.json +137 -17
  27. package/dist/schemas/anyQuestion.schema.json +847 -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
@@ -38,11 +38,14 @@ exports.AnyQuestionSchema = zod_1.z.discriminatedUnion('type', [
38
38
  dateQuestions_1.DateQuestionSchema,
39
39
  dateQuestions_1.DateRangeQuestionSchema,
40
40
  textQuestions_1.EmailQuestionSchema,
41
- // FilteredSearchQuestionSchema,
41
+ graphQLQuestions_1.LicenseSearchQuestionSchema,
42
+ graphQLQuestions_1.MetadataStandardSearchQuestionSchema,
42
43
  optionBasedQuestions_1.MultiselectBoxQuestionSchema,
43
44
  numberQuestions_1.NumberQuestionSchema,
44
45
  numberQuestions_1.NumberRangeQuestionSchema,
45
46
  optionBasedQuestions_1.RadioButtonsQuestionSchema,
47
+ graphQLQuestions_1.RepositorySearchQuestionSchema,
48
+ tableQuestions_1.ResearchOutputTableQuestionSchema,
46
49
  optionBasedQuestions_1.SelectBoxQuestionSchema,
47
50
  tableQuestions_1.TableQuestionSchema,
48
51
  textQuestions_1.TextAreaQuestionSchema,
@@ -58,11 +61,15 @@ exports.QuestionSchemaMap = {
58
61
  date: dateQuestions_1.DateQuestionSchema,
59
62
  dateRange: dateQuestions_1.DateRangeQuestionSchema,
60
63
  email: textQuestions_1.EmailQuestionSchema,
61
- // filteredSearch: FilteredSearchQuestionSchema,
64
+ licenseSearch: graphQLQuestions_1.LicenseSearchQuestionSchema,
65
+ metadataStandardSearch: graphQLQuestions_1.MetadataStandardSearchQuestionSchema,
62
66
  multiselectBox: optionBasedQuestions_1.MultiselectBoxQuestionSchema,
63
67
  number: numberQuestions_1.NumberQuestionSchema,
64
68
  numberRange: numberQuestions_1.NumberRangeQuestionSchema,
69
+ numberWithContext: numberQuestions_1.NumberWithContextQuestionSchema,
65
70
  radioButtons: optionBasedQuestions_1.RadioButtonsQuestionSchema,
71
+ repositorySearch: graphQLQuestions_1.RepositorySearchQuestionSchema,
72
+ researchOutputTable: tableQuestions_1.ResearchOutputTableQuestionSchema,
66
73
  selectBox: optionBasedQuestions_1.SelectBoxQuestionSchema,
67
74
  table: tableQuestions_1.TableQuestionSchema,
68
75
  text: textQuestions_1.TextQuestionSchema,
@@ -317,6 +317,111 @@ export declare const NumberRangeQuestionSchema: z.ZodObject<{
317
317
  } | undefined;
318
318
  } | undefined;
319
319
  }>;
320
+ export declare const NumberWithContextQuestionSchema: z.ZodObject<{
321
+ meta: z.ZodDefault<z.ZodObject<{
322
+ schemaVersion: z.ZodDefault<z.ZodString>;
323
+ title: z.ZodOptional<z.ZodString>;
324
+ usageDescription: z.ZodOptional<z.ZodString>;
325
+ }, "strip", z.ZodTypeAny, {
326
+ schemaVersion: string;
327
+ title?: string | undefined;
328
+ usageDescription?: string | undefined;
329
+ }, {
330
+ schemaVersion?: string | undefined;
331
+ title?: string | undefined;
332
+ usageDescription?: string | undefined;
333
+ }>>;
334
+ } & {
335
+ type: z.ZodLiteral<"numberWithContext">;
336
+ attributes: z.ZodDefault<z.ZodObject<{
337
+ label: z.ZodOptional<z.ZodString>;
338
+ help: z.ZodOptional<z.ZodString>;
339
+ labelTranslationKey: z.ZodOptional<z.ZodString>;
340
+ } & {
341
+ max: z.ZodOptional<z.ZodNumber>;
342
+ min: z.ZodDefault<z.ZodNumber>;
343
+ step: z.ZodDefault<z.ZodNumber>;
344
+ } & {
345
+ context: z.ZodDefault<z.ZodArray<z.ZodObject<{
346
+ label: z.ZodDefault<z.ZodString>;
347
+ labelTranslationKey: z.ZodOptional<z.ZodString>;
348
+ value: z.ZodDefault<z.ZodString>;
349
+ }, "strip", z.ZodTypeAny, {
350
+ value: string;
351
+ label: string;
352
+ labelTranslationKey?: string | undefined;
353
+ }, {
354
+ value?: string | undefined;
355
+ label?: string | undefined;
356
+ labelTranslationKey?: string | undefined;
357
+ }>, "many">>;
358
+ }, "strip", z.ZodTypeAny, {
359
+ context: {
360
+ value: string;
361
+ label: string;
362
+ labelTranslationKey?: string | undefined;
363
+ }[];
364
+ min: number;
365
+ step: number;
366
+ label?: string | undefined;
367
+ help?: string | undefined;
368
+ labelTranslationKey?: string | undefined;
369
+ max?: number | undefined;
370
+ }, {
371
+ label?: string | undefined;
372
+ help?: string | undefined;
373
+ labelTranslationKey?: string | undefined;
374
+ context?: {
375
+ value?: string | undefined;
376
+ label?: string | undefined;
377
+ labelTranslationKey?: string | undefined;
378
+ }[] | undefined;
379
+ max?: number | undefined;
380
+ min?: number | undefined;
381
+ step?: number | undefined;
382
+ }>>;
383
+ }, "strip", z.ZodTypeAny, {
384
+ type: "numberWithContext";
385
+ attributes: {
386
+ context: {
387
+ value: string;
388
+ label: string;
389
+ labelTranslationKey?: string | undefined;
390
+ }[];
391
+ min: number;
392
+ step: number;
393
+ label?: string | undefined;
394
+ help?: string | undefined;
395
+ labelTranslationKey?: string | undefined;
396
+ max?: number | undefined;
397
+ };
398
+ meta: {
399
+ schemaVersion: string;
400
+ title?: string | undefined;
401
+ usageDescription?: string | undefined;
402
+ };
403
+ }, {
404
+ type: "numberWithContext";
405
+ attributes?: {
406
+ label?: string | undefined;
407
+ help?: string | undefined;
408
+ labelTranslationKey?: string | undefined;
409
+ context?: {
410
+ value?: string | undefined;
411
+ label?: string | undefined;
412
+ labelTranslationKey?: string | undefined;
413
+ }[] | undefined;
414
+ max?: number | undefined;
415
+ min?: number | undefined;
416
+ step?: number | undefined;
417
+ } | undefined;
418
+ meta?: {
419
+ schemaVersion?: string | undefined;
420
+ title?: string | undefined;
421
+ usageDescription?: string | undefined;
422
+ } | undefined;
423
+ }>;
320
424
  export type CurrencyQuestionType = z.infer<typeof CurrencyQuestionSchema>;
321
425
  export type NumberQuestionType = z.infer<typeof NumberQuestionSchema>;
322
426
  export type NumberRangeQuestionType = z.infer<typeof NumberRangeQuestionSchema>;
427
+ export type NumberWithContextQuestionType = z.infer<typeof NumberWithContextQuestionSchema>;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.NumberRangeQuestionSchema = exports.NumberQuestionSchema = exports.CurrencyQuestionSchema = void 0;
3
+ exports.NumberWithContextQuestionSchema = exports.NumberRangeQuestionSchema = exports.NumberQuestionSchema = exports.CurrencyQuestionSchema = void 0;
4
4
  const zod_1 = require("zod");
5
5
  const question_1 = require("./question");
6
6
  const BaseAttributes = question_1.QuestionSchema.shape.attributes;
@@ -27,3 +27,14 @@ exports.NumberRangeQuestionSchema = question_1.QuestionSchema.merge(zod_1.z.obje
27
27
  end: NumberAttributesSchema.default({ label: 'To' }),
28
28
  }).default({})
29
29
  }));
30
+ exports.NumberWithContextQuestionSchema = question_1.QuestionSchema.merge(zod_1.z.object({
31
+ type: zod_1.z.literal('numberWithContext'),
32
+ attributes: NumberAttributesSchema.merge(zod_1.z.object({
33
+ // Additional context or description for the number input (e.g. units, explanation, etc.)
34
+ context: zod_1.z.array(zod_1.z.object({
35
+ label: zod_1.z.string().default(''),
36
+ labelTranslationKey: zod_1.z.string().optional(),
37
+ value: zod_1.z.string().default('')
38
+ })).default([])
39
+ })).default({})
40
+ }));
@@ -1,8 +1,8 @@
1
1
  import { z } from "zod";
2
2
  export declare const CURRENT_SCHEMA_VERSION = "1.0";
3
- export declare const QuestionFormatsEnum: z.ZodEnum<["affiliationSearch", "boolean", "checkBoxes", "currency", "date", "dateRange", "email", "multiselectBox", "number", "numberRange", "radioButtons", "selectBox", "table", "text", "textArea", "url"]>;
3
+ export declare const QuestionFormatsEnum: z.ZodEnum<["affiliationSearch", "boolean", "checkBoxes", "currency", "date", "dateRange", "email", "licenseSearch", "metadataStandardSearch", "multiselectBox", "number", "numberRange", "numberWithContext", "radioButtons", "repositorySearch", "researchOutputTable", "selectBox", "table", "text", "textArea", "url"]>;
4
4
  export declare const QuestionSchema: z.ZodObject<{
5
- type: z.ZodEnum<["affiliationSearch", "boolean", "checkBoxes", "currency", "date", "dateRange", "email", "multiselectBox", "number", "numberRange", "radioButtons", "selectBox", "table", "text", "textArea", "url"]>;
5
+ type: z.ZodEnum<["affiliationSearch", "boolean", "checkBoxes", "currency", "date", "dateRange", "email", "licenseSearch", "metadataStandardSearch", "multiselectBox", "number", "numberRange", "numberWithContext", "radioButtons", "repositorySearch", "researchOutputTable", "selectBox", "table", "text", "textArea", "url"]>;
6
6
  attributes: z.ZodObject<{
7
7
  label: z.ZodOptional<z.ZodString>;
8
8
  help: z.ZodOptional<z.ZodString>;
@@ -30,7 +30,7 @@ export declare const QuestionSchema: z.ZodObject<{
30
30
  usageDescription?: string | undefined;
31
31
  }>>;
32
32
  }, "strip", z.ZodTypeAny, {
33
- type: "number" | "boolean" | "affiliationSearch" | "checkBoxes" | "currency" | "date" | "dateRange" | "email" | "multiselectBox" | "numberRange" | "radioButtons" | "selectBox" | "table" | "text" | "textArea" | "url";
33
+ type: "number" | "boolean" | "affiliationSearch" | "checkBoxes" | "currency" | "date" | "dateRange" | "email" | "licenseSearch" | "metadataStandardSearch" | "multiselectBox" | "numberRange" | "numberWithContext" | "radioButtons" | "repositorySearch" | "researchOutputTable" | "selectBox" | "table" | "text" | "textArea" | "url";
34
34
  attributes: {
35
35
  label?: string | undefined;
36
36
  help?: string | undefined;
@@ -42,7 +42,7 @@ export declare const QuestionSchema: z.ZodObject<{
42
42
  usageDescription?: string | undefined;
43
43
  };
44
44
  }, {
45
- type: "number" | "boolean" | "affiliationSearch" | "checkBoxes" | "currency" | "date" | "dateRange" | "email" | "multiselectBox" | "numberRange" | "radioButtons" | "selectBox" | "table" | "text" | "textArea" | "url";
45
+ type: "number" | "boolean" | "affiliationSearch" | "checkBoxes" | "currency" | "date" | "dateRange" | "email" | "licenseSearch" | "metadataStandardSearch" | "multiselectBox" | "numberRange" | "numberWithContext" | "radioButtons" | "repositorySearch" | "researchOutputTable" | "selectBox" | "table" | "text" | "textArea" | "url";
46
46
  attributes: {
47
47
  label?: string | undefined;
48
48
  help?: string | undefined;
@@ -12,11 +12,15 @@ exports.QuestionFormatsEnum = zod_1.z.enum([
12
12
  'date',
13
13
  'dateRange',
14
14
  'email',
15
- // 'filteredSearch',
15
+ 'licenseSearch',
16
+ 'metadataStandardSearch',
16
17
  'multiselectBox',
17
18
  'number',
18
19
  'numberRange',
20
+ 'numberWithContext',
19
21
  'radioButtons',
22
+ 'repositorySearch',
23
+ 'researchOutputTable',
20
24
  'selectBox',
21
25
  'table',
22
26
  'text',
@@ -68,9 +72,14 @@ exports.QuestionFormatsUsage = {
68
72
  title: 'Email Field',
69
73
  usageDescription: 'For questions that require require email address(es).',
70
74
  },
71
- // filteredSearch: {
72
- // title: 'Not yet implemented',
73
- // },
75
+ licenseSearch: {
76
+ title: 'License Search',
77
+ usageDescription: 'For questions that require the user to select from a controlled list of licenses (e.g. Creative Commons, GNU, etc.).',
78
+ },
79
+ metadataStandardSearch: {
80
+ title: 'Metadata Standard Search',
81
+ usageDescription: 'For questions that require the user to select from a controlled list of metadata standards (e.g. Dublin Core, DataCite, etc.).',
82
+ },
74
83
  multiselectBox: {
75
84
  title: 'Multi-select Box',
76
85
  usageDescription: 'For questions where multiple answers are valid. Allows users to select several options from a predefined list, providing flexibility in responses.',
@@ -83,10 +92,22 @@ exports.QuestionFormatsUsage = {
83
92
  title: 'Number Range',
84
93
  usageDescription: 'For questions that require a numerical range (e.g. From/To, Min/Max).',
85
94
  },
95
+ numberWithContext: {
96
+ title: 'Number with Context',
97
+ usageDescription: 'For questions that require a numeric value along with additional context or description (e.g. units, explanation, etc.).',
98
+ },
86
99
  radioButtons: {
87
100
  title: 'Radio Buttons',
88
101
  usageDescription: 'For multiple choice questions where users select just one option.',
89
102
  },
103
+ repositorySearch: {
104
+ title: 'Repository Search',
105
+ usageDescription: 'For questions that require the user to select from a controlled list of repositories (e.g. Zenodo, Figshare, Dryad, etc.).',
106
+ },
107
+ researchOutputTable: {
108
+ title: 'Research Output Table',
109
+ usageDescription: 'For questions that require users to provide structured information about research outputs in a tabular format.',
110
+ },
90
111
  selectBox: {
91
112
  title: 'Select Box',
92
113
  usageDescription: 'For questions where users select one option from a list.',