@dmptool/types 1.2.5 → 2.0.0

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 (97) hide show
  1. package/README.md +1 -1
  2. package/dist/answers/__tests__/defaults.spec.js +216 -0
  3. package/dist/answers/answer.d.ts +29 -14
  4. package/dist/answers/answer.js +11 -5
  5. package/dist/answers/dateAnswers.d.ts +20 -47
  6. package/dist/answers/dateAnswers.js +20 -10
  7. package/dist/answers/graphQLAnswers.d.ts +48 -120
  8. package/dist/answers/graphQLAnswers.js +46 -21
  9. package/dist/answers/index.d.ts +155 -1439
  10. package/dist/answers/index.js +26 -1
  11. package/dist/answers/numberAnswers.d.ts +38 -92
  12. package/dist/answers/numberAnswers.js +38 -19
  13. package/dist/answers/optionBasedAnswers.d.ts +42 -87
  14. package/dist/answers/optionBasedAnswers.js +37 -21
  15. package/dist/answers/tableAnswers.d.ts +348 -3032
  16. package/dist/answers/tableAnswers.js +25 -61
  17. package/dist/answers/textAnswers.d.ts +32 -68
  18. package/dist/answers/textAnswers.js +30 -17
  19. package/dist/questions/__tests__/dateQuestions.spec.js +3 -0
  20. package/dist/questions/__tests__/defaults.spec.d.ts +1 -0
  21. package/dist/questions/__tests__/defaults.spec.js +668 -0
  22. package/dist/questions/__tests__/optionBasedQuestions.spec.js +3 -2
  23. package/dist/questions/__tests__/tableQuestion.spec.js +22 -23
  24. package/dist/questions/__tests__/textQuestions.spec.js +32 -0
  25. package/dist/questions/dateQuestions.d.ts +45 -191
  26. package/dist/questions/dateQuestions.js +26 -23
  27. package/dist/questions/graphQLQuestions.d.ts +262 -556
  28. package/dist/questions/graphQLQuestions.js +225 -223
  29. package/dist/questions/index.d.ts +680 -8090
  30. package/dist/questions/index.js +26 -1
  31. package/dist/questions/numberQuestions.d.ts +85 -331
  32. package/dist/questions/numberQuestions.js +50 -36
  33. package/dist/questions/optionBasedQuestions.d.ts +83 -290
  34. package/dist/questions/optionBasedQuestions.js +58 -41
  35. package/dist/questions/question.d.ts +72 -35
  36. package/dist/questions/question.js +14 -5
  37. package/dist/questions/tableQuestions.d.ts +2029 -10357
  38. package/dist/questions/tableQuestions.js +197 -190
  39. package/dist/questions/textQuestions.d.ts +70 -226
  40. package/dist/questions/textQuestions.js +31 -31
  41. package/package.json +3 -4
  42. package/dist/answers/__tests__/usage.spec.js +0 -178
  43. package/dist/questions/__tests__/usage.spec.d.ts +0 -8
  44. package/dist/questions/__tests__/usage.spec.js +0 -473
  45. package/dist/schemas/affiliationSearchAnswer.schema.json +0 -45
  46. package/dist/schemas/affiliationSearchQuestion.schema.json +0 -140
  47. package/dist/schemas/anyAnswer.schema.json +0 -605
  48. package/dist/schemas/anyQuestion.schema.json +0 -1737
  49. package/dist/schemas/anyTableColumnAnswer.schema.json +0 -466
  50. package/dist/schemas/anyTableColumnQuestion.schema.json +0 -1092
  51. package/dist/schemas/booleanAnswer.schema.json +0 -34
  52. package/dist/schemas/booleanQuestion.schema.json +0 -56
  53. package/dist/schemas/checkboxesAnswer.schema.json +0 -39
  54. package/dist/schemas/checkboxesQuestion.schema.json +0 -76
  55. package/dist/schemas/currencyAnswer.schema.json +0 -34
  56. package/dist/schemas/currencyQuestion.schema.json +0 -67
  57. package/dist/schemas/dateAnswer.schema.json +0 -34
  58. package/dist/schemas/datePickerAnswer.schema.json +0 -37
  59. package/dist/schemas/datePickerQuestion.schema.json +0 -52
  60. package/dist/schemas/dateQuestion.schema.json +0 -62
  61. package/dist/schemas/dateRangeAnswer.schema.json +0 -45
  62. package/dist/schemas/dateRangeQuestion.schema.json +0 -112
  63. package/dist/schemas/emailAnswer.schema.json +0 -34
  64. package/dist/schemas/emailQuestion.schema.json +0 -66
  65. package/dist/schemas/filteredSearchAnswer.schema.json +0 -40
  66. package/dist/schemas/filteredSearchQuestion.schema.json +0 -130
  67. package/dist/schemas/licenseSearchAnswer.schema.json +0 -49
  68. package/dist/schemas/licenseSearchQuestion.schema.json +0 -164
  69. package/dist/schemas/metadataStandardSearchAnswer.schema.json +0 -49
  70. package/dist/schemas/metadataStandardSearchQuestion.schema.json +0 -174
  71. package/dist/schemas/multiselectBoxAnswer.schema.json +0 -39
  72. package/dist/schemas/multiselectBoxQuestion.schema.json +0 -85
  73. package/dist/schemas/numberAnswer.schema.json +0 -34
  74. package/dist/schemas/numberQuestion.schema.json +0 -63
  75. package/dist/schemas/numberRangeAnswer.schema.json +0 -45
  76. package/dist/schemas/numberRangeQuestion.schema.json +0 -94
  77. package/dist/schemas/numberWithContextAnswer.schema.json +0 -45
  78. package/dist/schemas/numberWithContextQuestion.schema.json +0 -84
  79. package/dist/schemas/radioButtonsAnswer.schema.json +0 -34
  80. package/dist/schemas/radioButtonsQuestion.schema.json +0 -76
  81. package/dist/schemas/repositorySearchAnswer.schema.json +0 -49
  82. package/dist/schemas/repositorySearchQuestion.schema.json +0 -180
  83. package/dist/schemas/researchOutputTableAnswer.schema.json +0 -519
  84. package/dist/schemas/researchOutputTableQuestion.schema.json +0 -1183
  85. package/dist/schemas/selectBoxAnswer.schema.json +0 -34
  86. package/dist/schemas/selectBoxQuestion.schema.json +0 -85
  87. package/dist/schemas/tableAnswer.schema.json +0 -519
  88. package/dist/schemas/tableQuestion.schema.json +0 -1183
  89. package/dist/schemas/textAnswer.schema.json +0 -34
  90. package/dist/schemas/textAreaAnswer.schema.json +0 -34
  91. package/dist/schemas/textAreaQuestion.schema.json +0 -70
  92. package/dist/schemas/textQuestion.schema.json +0 -62
  93. package/dist/schemas/typeaheadSearchAnswer.schema.json +0 -37
  94. package/dist/schemas/typeaheadSearchQuestion.schema.json +0 -120
  95. package/dist/schemas/urlAnswer.schema.json +0 -34
  96. package/dist/schemas/urlQuestion.schema.json +0 -62
  97. /package/dist/answers/__tests__/{usage.spec.d.ts → defaults.spec.d.ts} +0 -0
package/README.md CHANGED
@@ -7,7 +7,7 @@ This package provides Types, Zod schemas and JSON schemas to aide in integration
7
7
  The current version of the schemas can always be found in `CURRENT_SCHEMA_VERSION`. You will need to include the version is any object you create using the types in this file.
8
8
 
9
9
  Naming conventions:
10
- - Zod schemas do not include the word `Type` (e.g. `BooleanQuestion`, `CheckboxesAnswer`)
10
+ - Zod schemas include the word `Schema` (e.g. `BooleanQuestionSchema`, `CheckboxesAnswerSchema`)
11
11
  - Types include the word `Type` (e.g. `BooleanQuestionType`, `CheckboxesAnswerType`)
12
12
 
13
13
  ## DMP Template Support
@@ -0,0 +1,216 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const questions_1 = require("../../questions");
4
+ const index_1 = require("../index");
5
+ describe('Get question answer defaultJSON', () => {
6
+ it('returns the expected default affiliationSearch', () => {
7
+ const expected = {
8
+ type: "affiliationSearch",
9
+ answer: {
10
+ affiliationId: "",
11
+ affiliationName: "",
12
+ },
13
+ meta: { schemaVersion: questions_1.CURRENT_SCHEMA_VERSION },
14
+ };
15
+ expect(index_1.DefaultAffiliationSearchAnswer).toEqual(expected);
16
+ });
17
+ it('returns the expected default boolean', () => {
18
+ const expected = {
19
+ type: "boolean",
20
+ answer: false,
21
+ meta: { schemaVersion: questions_1.CURRENT_SCHEMA_VERSION },
22
+ };
23
+ expect(index_1.DefaultBooleanAnswer).toEqual(expected);
24
+ });
25
+ it('returns the expected default checkBoxes', () => {
26
+ const expected = {
27
+ type: "checkBoxes",
28
+ answer: [],
29
+ meta: { schemaVersion: questions_1.CURRENT_SCHEMA_VERSION },
30
+ };
31
+ expect(index_1.DefaultCheckboxesAnswer).toEqual(expected);
32
+ });
33
+ it('returns the expected default currency', () => {
34
+ const expected = {
35
+ type: "currency",
36
+ answer: 0,
37
+ meta: { schemaVersion: questions_1.CURRENT_SCHEMA_VERSION },
38
+ };
39
+ expect(index_1.DefaultCurrencyAnswer).toEqual(expected);
40
+ });
41
+ it('returns the expected default date', () => {
42
+ const expected = {
43
+ type: "date",
44
+ answer: "",
45
+ meta: { schemaVersion: questions_1.CURRENT_SCHEMA_VERSION },
46
+ };
47
+ expect(index_1.DefaultDateAnswer).toEqual(expected);
48
+ });
49
+ it('returns the expected default dateRange', () => {
50
+ const expected = {
51
+ type: "dateRange",
52
+ answer: {
53
+ start: "",
54
+ end: "",
55
+ },
56
+ meta: { schemaVersion: questions_1.CURRENT_SCHEMA_VERSION },
57
+ };
58
+ expect(index_1.DefaultDateRangeAnswer).toEqual(expected);
59
+ });
60
+ it('returns the expected default email', () => {
61
+ const expected = {
62
+ type: "email",
63
+ answer: "",
64
+ meta: { schemaVersion: questions_1.CURRENT_SCHEMA_VERSION },
65
+ };
66
+ expect(index_1.DefaultEmailAnswer).toEqual(expected);
67
+ });
68
+ it('returns the expected default licenseSearch', () => {
69
+ const expected = {
70
+ type: "licenseSearch",
71
+ answer: [{
72
+ licenseId: "",
73
+ licenseName: "",
74
+ }],
75
+ meta: { schemaVersion: questions_1.CURRENT_SCHEMA_VERSION },
76
+ };
77
+ expect(index_1.DefaultLicenseSearchAnswer).toEqual(expected);
78
+ });
79
+ it('returns the expected default metadataStandardSearch', () => {
80
+ const expected = {
81
+ type: "metadataStandardSearch",
82
+ answer: [{
83
+ metadataStandardId: "",
84
+ metadataStandardName: "",
85
+ }],
86
+ meta: { schemaVersion: questions_1.CURRENT_SCHEMA_VERSION },
87
+ };
88
+ expect(index_1.DefaultMetadataStandardSearchAnswer).toEqual(expected);
89
+ });
90
+ it('returns the expected default multiselectBox', () => {
91
+ const expected = {
92
+ type: "multiselectBox",
93
+ answer: [],
94
+ meta: { schemaVersion: questions_1.CURRENT_SCHEMA_VERSION },
95
+ };
96
+ expect(index_1.DefaultMultiselectBoxAnswer).toEqual(expected);
97
+ });
98
+ it('returns the expected default number', () => {
99
+ const expected = {
100
+ type: "number",
101
+ answer: 0,
102
+ meta: { schemaVersion: questions_1.CURRENT_SCHEMA_VERSION },
103
+ };
104
+ expect(index_1.DefaultNumberAnswer).toEqual(expected);
105
+ });
106
+ it('returns the expected default numberRange', () => {
107
+ const expected = {
108
+ type: "numberRange",
109
+ answer: {
110
+ start: 0,
111
+ end: 0,
112
+ },
113
+ meta: { schemaVersion: questions_1.CURRENT_SCHEMA_VERSION },
114
+ };
115
+ expect(index_1.DefaultNumberRangeAnswer).toEqual(expected);
116
+ });
117
+ it('returns the expected default numberWithContext', () => {
118
+ const expected = {
119
+ type: "numberWithContext",
120
+ answer: {
121
+ value: 0,
122
+ context: "",
123
+ },
124
+ meta: { schemaVersion: questions_1.CURRENT_SCHEMA_VERSION },
125
+ };
126
+ expect(index_1.DefaultNumberWithContextAnswer).toEqual(expected);
127
+ });
128
+ it('returns the expected default radioButtons', () => {
129
+ const expected = {
130
+ type: "radioButtons",
131
+ answer: "",
132
+ meta: { schemaVersion: questions_1.CURRENT_SCHEMA_VERSION },
133
+ };
134
+ expect(index_1.DefaultRadioButtonsAnswer).toEqual(expected);
135
+ });
136
+ it('returns the expected default repositorySearch', () => {
137
+ const expected = {
138
+ type: "repositorySearch",
139
+ answer: [{
140
+ repositoryId: "",
141
+ repositoryName: "",
142
+ }],
143
+ meta: { schemaVersion: questions_1.CURRENT_SCHEMA_VERSION },
144
+ };
145
+ expect(index_1.DefaultRepositorySearchAnswer).toEqual(expected);
146
+ });
147
+ it('returns the expected default researchOutputTable', () => {
148
+ const expected = {
149
+ type: "researchOutputTable",
150
+ columnHeadings: ["Title", "Type"],
151
+ answer: [{
152
+ columns: [
153
+ {
154
+ type: "text",
155
+ answer: "",
156
+ meta: { schemaVersion: questions_1.CURRENT_SCHEMA_VERSION },
157
+ },
158
+ {
159
+ type: "selectBox",
160
+ answer: "",
161
+ meta: { schemaVersion: questions_1.CURRENT_SCHEMA_VERSION },
162
+ }
163
+ ]
164
+ }],
165
+ meta: { schemaVersion: questions_1.CURRENT_SCHEMA_VERSION },
166
+ };
167
+ expect(index_1.DefaultResearchOutputTableAnswer).toEqual(expected);
168
+ });
169
+ it('returns the expected default selectBox', () => {
170
+ const expected = {
171
+ type: "selectBox",
172
+ answer: "",
173
+ meta: { schemaVersion: questions_1.CURRENT_SCHEMA_VERSION },
174
+ };
175
+ expect(index_1.DefaultSelectBoxAnswer).toEqual(expected);
176
+ });
177
+ it('returns the expected default table', () => {
178
+ const expected = {
179
+ type: "table",
180
+ columnHeadings: ["Column A"],
181
+ answer: [{
182
+ columns: [{
183
+ type: "textArea",
184
+ answer: "",
185
+ meta: { schemaVersion: questions_1.CURRENT_SCHEMA_VERSION },
186
+ }]
187
+ }],
188
+ meta: { schemaVersion: questions_1.CURRENT_SCHEMA_VERSION },
189
+ };
190
+ expect(index_1.DefaultTableAnswer).toEqual(expected);
191
+ });
192
+ it('returns the expected default text', () => {
193
+ const expected = {
194
+ type: "text",
195
+ answer: "",
196
+ meta: { schemaVersion: questions_1.CURRENT_SCHEMA_VERSION },
197
+ };
198
+ expect(index_1.DefaultTextAnswer).toEqual(expected);
199
+ });
200
+ it('returns the expected default textArea', () => {
201
+ const expected = {
202
+ type: "textArea",
203
+ answer: "",
204
+ meta: { schemaVersion: questions_1.CURRENT_SCHEMA_VERSION },
205
+ };
206
+ expect(index_1.DefaultTextAreaAnswer).toEqual(expected);
207
+ });
208
+ it('returns the expected default url', () => {
209
+ const expected = {
210
+ type: "url",
211
+ answer: "",
212
+ meta: { schemaVersion: questions_1.CURRENT_SCHEMA_VERSION },
213
+ };
214
+ expect(index_1.DefaultURLAnswer).toEqual(expected);
215
+ });
216
+ });
@@ -1,22 +1,37 @@
1
1
  import { z } from 'zod';
2
2
  export declare const AnswerSchema: z.ZodObject<{
3
- type: z.ZodEnum<["affiliationSearch", "boolean", "checkBoxes", "currency", "date", "dateRange", "email", "licenseSearch", "metadataStandardSearch", "multiselectBox", "number", "numberRange", "numberWithContext", "radioButtons", "repositorySearch", "researchOutputTable", "selectBox", "table", "text", "textArea", "url"]>;
4
- meta: z.ZodDefault<z.ZodObject<{
3
+ type: z.ZodEnum<{
4
+ number: "number";
5
+ boolean: "boolean";
6
+ affiliationSearch: "affiliationSearch";
7
+ checkBoxes: "checkBoxes";
8
+ currency: "currency";
9
+ date: "date";
10
+ dateRange: "dateRange";
11
+ email: "email";
12
+ licenseSearch: "licenseSearch";
13
+ metadataStandardSearch: "metadataStandardSearch";
14
+ multiselectBox: "multiselectBox";
15
+ numberRange: "numberRange";
16
+ numberWithContext: "numberWithContext";
17
+ radioButtons: "radioButtons";
18
+ repositorySearch: "repositorySearch";
19
+ researchOutputTable: "researchOutputTable";
20
+ selectBox: "selectBox";
21
+ table: "table";
22
+ text: "text";
23
+ textArea: "textArea";
24
+ url: "url";
25
+ }>;
26
+ meta: z.ZodObject<{
5
27
  schemaVersion: z.ZodDefault<z.ZodString>;
6
- }, "strip", z.ZodTypeAny, {
7
- schemaVersion: string;
8
- }, {
9
- schemaVersion?: string | undefined;
10
- }>>;
11
- }, "strip", z.ZodTypeAny, {
28
+ }, z.core.$strip>;
29
+ }, z.core.$strip>;
30
+ export declare const DefaultAnswer: {
12
31
  type: "number" | "boolean" | "affiliationSearch" | "checkBoxes" | "currency" | "date" | "dateRange" | "email" | "licenseSearch" | "metadataStandardSearch" | "multiselectBox" | "numberRange" | "numberWithContext" | "radioButtons" | "repositorySearch" | "researchOutputTable" | "selectBox" | "table" | "text" | "textArea" | "url";
13
32
  meta: {
14
33
  schemaVersion: string;
15
34
  };
16
- }, {
17
- type: "number" | "boolean" | "affiliationSearch" | "checkBoxes" | "currency" | "date" | "dateRange" | "email" | "licenseSearch" | "metadataStandardSearch" | "multiselectBox" | "numberRange" | "numberWithContext" | "radioButtons" | "repositorySearch" | "researchOutputTable" | "selectBox" | "table" | "text" | "textArea" | "url";
18
- meta?: {
19
- schemaVersion?: string | undefined;
20
- } | undefined;
21
- }>;
35
+ };
22
36
  export type AnswerType = z.infer<typeof AnswerSchema>;
37
+ export declare const AnswerJSONSchema: z.core.JSONSchema.JSONSchema;
@@ -1,12 +1,18 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.AnswerSchema = void 0;
3
+ exports.AnswerJSONSchema = exports.DefaultAnswer = exports.AnswerSchema = void 0;
4
4
  const zod_1 = require("zod");
5
- const question_1 = require("../questions/question");
5
+ const questions_1 = require("../questions");
6
6
  // Abstract base schema for all answers
7
7
  exports.AnswerSchema = zod_1.z.object({
8
- type: question_1.QuestionFormatsEnum, // The type of answer
8
+ type: questions_1.QuestionFormatsEnum, // The type of answer
9
9
  meta: zod_1.z.object({
10
- schemaVersion: zod_1.z.string().default(question_1.CURRENT_SCHEMA_VERSION), // The schema version of the answer
11
- }).default({})
10
+ schemaVersion: zod_1.z.string().default(questions_1.CURRENT_SCHEMA_VERSION), // The schema version of the answer
11
+ })
12
12
  });
13
+ exports.DefaultAnswer = exports.AnswerSchema.parse({
14
+ type: 'textArea',
15
+ answer: "",
16
+ meta: questions_1.DefaultMeta
17
+ });
18
+ exports.AnswerJSONSchema = zod_1.z.toJSONSchema(exports.AnswerSchema);
@@ -1,66 +1,39 @@
1
1
  import { z } from 'zod';
2
2
  export declare const DateAnswerSchema: z.ZodObject<{
3
- meta: z.ZodDefault<z.ZodObject<{
4
- schemaVersion: z.ZodDefault<z.ZodString>;
5
- }, "strip", z.ZodTypeAny, {
6
- schemaVersion: string;
7
- }, {
8
- schemaVersion?: string | undefined;
9
- }>>;
10
- } & {
11
3
  type: z.ZodLiteral<"date">;
12
4
  answer: z.ZodDefault<z.ZodString>;
13
- }, "strip", z.ZodTypeAny, {
5
+ meta: z.ZodObject<{
6
+ schemaVersion: z.ZodDefault<z.ZodString>;
7
+ }, z.core.$strip>;
8
+ }, z.core.$strip>;
9
+ export declare const DefaultDateAnswer: {
14
10
  type: "date";
11
+ answer: string;
15
12
  meta: {
16
13
  schemaVersion: string;
17
14
  };
18
- answer: string;
19
- }, {
20
- type: "date";
21
- meta?: {
22
- schemaVersion?: string | undefined;
23
- } | undefined;
24
- answer?: string | undefined;
25
- }>;
15
+ };
26
16
  export declare const DateRangeAnswerSchema: z.ZodObject<{
27
- meta: z.ZodDefault<z.ZodObject<{
28
- schemaVersion: z.ZodDefault<z.ZodString>;
29
- }, "strip", z.ZodTypeAny, {
30
- schemaVersion: string;
31
- }, {
32
- schemaVersion?: string | undefined;
33
- }>>;
34
- } & {
35
17
  type: z.ZodLiteral<"dateRange">;
36
- answer: z.ZodDefault<z.ZodObject<{
18
+ answer: z.ZodObject<{
37
19
  start: z.ZodDefault<z.ZodString>;
38
20
  end: z.ZodDefault<z.ZodString>;
39
- }, "strip", z.ZodTypeAny, {
40
- start: string;
41
- end: string;
42
- }, {
43
- start?: string | undefined;
44
- end?: string | undefined;
45
- }>>;
46
- }, "strip", z.ZodTypeAny, {
21
+ }, z.core.$strip>;
22
+ meta: z.ZodObject<{
23
+ schemaVersion: z.ZodDefault<z.ZodString>;
24
+ }, z.core.$strip>;
25
+ }, z.core.$strip>;
26
+ export declare const DefaultDateRangeAnswer: {
47
27
  type: "dateRange";
48
- meta: {
49
- schemaVersion: string;
50
- };
51
28
  answer: {
52
29
  start: string;
53
30
  end: string;
54
31
  };
55
- }, {
56
- type: "dateRange";
57
- meta?: {
58
- schemaVersion?: string | undefined;
59
- } | undefined;
60
- answer?: {
61
- start?: string | undefined;
62
- end?: string | undefined;
63
- } | undefined;
64
- }>;
32
+ meta: {
33
+ schemaVersion: string;
34
+ };
35
+ };
65
36
  export type DateAnswerType = z.infer<typeof DateAnswerSchema>;
66
37
  export type DateRangeAnswerType = z.infer<typeof DateRangeAnswerSchema>;
38
+ export declare const DateAnswerJSONSchema: z.core.JSONSchema.JSONSchema;
39
+ export declare const DateRangeAnswerJSONSchema: z.core.JSONSchema.JSONSchema;
@@ -1,17 +1,27 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.DateRangeAnswerSchema = exports.DateAnswerSchema = void 0;
3
+ exports.DateRangeAnswerJSONSchema = exports.DateAnswerJSONSchema = exports.DefaultDateRangeAnswer = exports.DateRangeAnswerSchema = exports.DefaultDateAnswer = exports.DateAnswerSchema = void 0;
4
4
  const zod_1 = require("zod");
5
5
  const answer_1 = require("./answer");
6
+ const questions_1 = require("../questions");
6
7
  // Answers to Date Question Types
7
- exports.DateAnswerSchema = answer_1.AnswerSchema.merge(zod_1.z.object({
8
- type: zod_1.z.literal('date'),
9
- answer: zod_1.z.string().default('')
10
- }));
11
- exports.DateRangeAnswerSchema = answer_1.AnswerSchema.merge(zod_1.z.object({
12
- type: zod_1.z.literal('dateRange'),
13
- answer: zod_1.z.object({
8
+ exports.DateAnswerSchema = zod_1.z.object(Object.assign(Object.assign({}, answer_1.AnswerSchema.shape), { type: zod_1.z.literal('date'), answer: zod_1.z.string().default('') }));
9
+ exports.DefaultDateAnswer = exports.DateAnswerSchema.parse({
10
+ type: 'date',
11
+ answer: '',
12
+ meta: questions_1.DefaultMeta
13
+ });
14
+ exports.DateRangeAnswerSchema = zod_1.z.object(Object.assign(Object.assign({}, answer_1.AnswerSchema.shape), { type: zod_1.z.literal('dateRange'), answer: zod_1.z.object({
14
15
  start: zod_1.z.string().default(''), // The start date (string)
15
16
  end: zod_1.z.string().default('') // The end date (string)
16
- }).default({})
17
- }));
17
+ }) }));
18
+ exports.DefaultDateRangeAnswer = exports.DateRangeAnswerSchema.parse({
19
+ type: 'dateRange',
20
+ answer: {
21
+ start: '',
22
+ end: ''
23
+ },
24
+ meta: questions_1.DefaultMeta
25
+ });
26
+ exports.DateAnswerJSONSchema = zod_1.z.toJSONSchema(exports.DateAnswerSchema);
27
+ exports.DateRangeAnswerJSONSchema = zod_1.z.toJSONSchema(exports.DateRangeAnswerSchema);
@@ -1,161 +1,89 @@
1
1
  import { z } from 'zod';
2
2
  export declare const AffiliationSearchAnswerSchema: z.ZodObject<{
3
- meta: z.ZodDefault<z.ZodObject<{
4
- schemaVersion: z.ZodDefault<z.ZodString>;
5
- }, "strip", z.ZodTypeAny, {
6
- schemaVersion: string;
7
- }, {
8
- schemaVersion?: string | undefined;
9
- }>>;
10
- } & {
11
3
  type: z.ZodLiteral<"affiliationSearch">;
12
- answer: z.ZodDefault<z.ZodObject<{
4
+ answer: z.ZodObject<{
13
5
  affiliationId: z.ZodDefault<z.ZodString>;
14
6
  affiliationName: z.ZodDefault<z.ZodString>;
15
- }, "strip", z.ZodTypeAny, {
16
- affiliationId: string;
17
- affiliationName: string;
18
- }, {
19
- affiliationId?: string | undefined;
20
- affiliationName?: string | undefined;
21
- }>>;
22
- }, "strip", z.ZodTypeAny, {
7
+ }, z.core.$strip>;
8
+ meta: z.ZodObject<{
9
+ schemaVersion: z.ZodDefault<z.ZodString>;
10
+ }, z.core.$strip>;
11
+ }, z.core.$strip>;
12
+ export declare const DefaultAffiliationSearchAnswer: {
23
13
  type: "affiliationSearch";
24
- meta: {
25
- schemaVersion: string;
26
- };
27
14
  answer: {
28
15
  affiliationId: string;
29
16
  affiliationName: string;
30
17
  };
31
- }, {
32
- type: "affiliationSearch";
33
- meta?: {
34
- schemaVersion?: string | undefined;
35
- } | undefined;
36
- answer?: {
37
- affiliationId?: string | undefined;
38
- affiliationName?: string | undefined;
39
- } | undefined;
40
- }>;
41
- export declare const LicenseSearchAnswerSchema: z.ZodObject<{
42
- meta: z.ZodDefault<z.ZodObject<{
43
- schemaVersion: z.ZodDefault<z.ZodString>;
44
- }, "strip", z.ZodTypeAny, {
18
+ meta: {
45
19
  schemaVersion: string;
46
- }, {
47
- schemaVersion?: string | undefined;
48
- }>>;
49
- } & {
20
+ };
21
+ };
22
+ export declare const LicenseSearchAnswerSchema: z.ZodObject<{
50
23
  type: z.ZodLiteral<"licenseSearch">;
51
- answer: z.ZodDefault<z.ZodArray<z.ZodDefault<z.ZodObject<{
24
+ answer: z.ZodDefault<z.ZodArray<z.ZodObject<{
52
25
  licenseId: z.ZodDefault<z.ZodString>;
53
26
  licenseName: z.ZodDefault<z.ZodString>;
54
- }, "strip", z.ZodTypeAny, {
55
- licenseId: string;
56
- licenseName: string;
57
- }, {
58
- licenseId?: string | undefined;
59
- licenseName?: string | undefined;
60
- }>>, "many">>;
61
- }, "strip", z.ZodTypeAny, {
27
+ }, z.core.$strip>>>;
28
+ meta: z.ZodObject<{
29
+ schemaVersion: z.ZodDefault<z.ZodString>;
30
+ }, z.core.$strip>;
31
+ }, z.core.$strip>;
32
+ export declare const DefaultLicenseSearchAnswer: {
62
33
  type: "licenseSearch";
63
- meta: {
64
- schemaVersion: string;
65
- };
66
34
  answer: {
67
35
  licenseId: string;
68
36
  licenseName: string;
69
37
  }[];
70
- }, {
71
- type: "licenseSearch";
72
- meta?: {
73
- schemaVersion?: string | undefined;
74
- } | undefined;
75
- answer?: ({
76
- licenseId?: string | undefined;
77
- licenseName?: string | undefined;
78
- } | undefined)[] | undefined;
79
- }>;
80
- export declare const MetadataStandardSearchAnswerSchema: z.ZodObject<{
81
- meta: z.ZodDefault<z.ZodObject<{
82
- schemaVersion: z.ZodDefault<z.ZodString>;
83
- }, "strip", z.ZodTypeAny, {
38
+ meta: {
84
39
  schemaVersion: string;
85
- }, {
86
- schemaVersion?: string | undefined;
87
- }>>;
88
- } & {
40
+ };
41
+ };
42
+ export declare const MetadataStandardSearchAnswerSchema: z.ZodObject<{
89
43
  type: z.ZodLiteral<"metadataStandardSearch">;
90
- answer: z.ZodDefault<z.ZodArray<z.ZodDefault<z.ZodObject<{
44
+ answer: z.ZodDefault<z.ZodArray<z.ZodObject<{
91
45
  metadataStandardId: z.ZodDefault<z.ZodString>;
92
46
  metadataStandardName: z.ZodDefault<z.ZodString>;
93
- }, "strip", z.ZodTypeAny, {
94
- metadataStandardId: string;
95
- metadataStandardName: string;
96
- }, {
97
- metadataStandardId?: string | undefined;
98
- metadataStandardName?: string | undefined;
99
- }>>, "many">>;
100
- }, "strip", z.ZodTypeAny, {
47
+ }, z.core.$strip>>>;
48
+ meta: z.ZodObject<{
49
+ schemaVersion: z.ZodDefault<z.ZodString>;
50
+ }, z.core.$strip>;
51
+ }, z.core.$strip>;
52
+ export declare const DefaultMetadataStandardSearchAnswer: {
101
53
  type: "metadataStandardSearch";
102
- meta: {
103
- schemaVersion: string;
104
- };
105
54
  answer: {
106
55
  metadataStandardId: string;
107
56
  metadataStandardName: string;
108
57
  }[];
109
- }, {
110
- type: "metadataStandardSearch";
111
- meta?: {
112
- schemaVersion?: string | undefined;
113
- } | undefined;
114
- answer?: ({
115
- metadataStandardId?: string | undefined;
116
- metadataStandardName?: string | undefined;
117
- } | undefined)[] | undefined;
118
- }>;
119
- export declare const RepositorySearchAnswerSchema: z.ZodObject<{
120
- meta: z.ZodDefault<z.ZodObject<{
121
- schemaVersion: z.ZodDefault<z.ZodString>;
122
- }, "strip", z.ZodTypeAny, {
58
+ meta: {
123
59
  schemaVersion: string;
124
- }, {
125
- schemaVersion?: string | undefined;
126
- }>>;
127
- } & {
60
+ };
61
+ };
62
+ export declare const RepositorySearchAnswerSchema: z.ZodObject<{
128
63
  type: z.ZodLiteral<"repositorySearch">;
129
- answer: z.ZodDefault<z.ZodArray<z.ZodDefault<z.ZodObject<{
64
+ answer: z.ZodDefault<z.ZodArray<z.ZodObject<{
130
65
  repositoryId: z.ZodDefault<z.ZodString>;
131
66
  repositoryName: z.ZodDefault<z.ZodString>;
132
- }, "strip", z.ZodTypeAny, {
133
- repositoryId: string;
134
- repositoryName: string;
135
- }, {
136
- repositoryId?: string | undefined;
137
- repositoryName?: string | undefined;
138
- }>>, "many">>;
139
- }, "strip", z.ZodTypeAny, {
67
+ }, z.core.$strip>>>;
68
+ meta: z.ZodObject<{
69
+ schemaVersion: z.ZodDefault<z.ZodString>;
70
+ }, z.core.$strip>;
71
+ }, z.core.$strip>;
72
+ export declare const DefaultRepositorySearchAnswer: {
140
73
  type: "repositorySearch";
141
- meta: {
142
- schemaVersion: string;
143
- };
144
74
  answer: {
145
75
  repositoryId: string;
146
76
  repositoryName: string;
147
77
  }[];
148
- }, {
149
- type: "repositorySearch";
150
- meta?: {
151
- schemaVersion?: string | undefined;
152
- } | undefined;
153
- answer?: ({
154
- repositoryId?: string | undefined;
155
- repositoryName?: string | undefined;
156
- } | undefined)[] | undefined;
157
- }>;
78
+ meta: {
79
+ schemaVersion: string;
80
+ };
81
+ };
158
82
  export type AffiliationSearchAnswerType = z.infer<typeof AffiliationSearchAnswerSchema>;
159
83
  export type LicenseSearchAnswerType = z.infer<typeof LicenseSearchAnswerSchema>;
160
84
  export type MetadataStandardSearchAnswerType = z.infer<typeof MetadataStandardSearchAnswerSchema>;
161
85
  export type RepositorySearchAnswerType = z.infer<typeof RepositorySearchAnswerSchema>;
86
+ export declare const AffiliationSearchAnswerJSONSchema: z.core.JSONSchema.JSONSchema;
87
+ export declare const LicenseSearchAnswerJSONSchema: z.core.JSONSchema.JSONSchema;
88
+ export declare const MetadataStandardSearchAnswerJSONSchema: z.core.JSONSchema.JSONSchema;
89
+ export declare const RepositorySearchAnswerJSONSchema: z.core.JSONSchema.JSONSchema;