@encatch/schema 0.1.22 → 0.1.24

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.
package/dist/esm/index.js CHANGED
@@ -393,84 +393,42 @@ var combinedQuestionSchema = z.discriminatedUnion("type", [
393
393
 
394
394
  // src/schemas/fields/answer-schema.ts
395
395
  import { z as z2 } from "zod";
396
- var SimpleAnswerSchema = z2.object({
397
- type: z2.literal("simple").describe("Indicates this is a simple answer with a single value"),
398
- value: z2.union([z2.string(), z2.number(), z2.boolean()]).describe("The answer value - can be text, number, or boolean")
399
- }).describe(
400
- "A simple answer containing a single value like text, number, or boolean"
401
- );
402
- var ChoiceAnswerSchema = z2.object({
403
- type: z2.literal("choice").describe("Indicates this is a single-choice answer"),
404
- selectedOptionId: z2.string().describe("The ID of the selected option from the available choices")
405
- }).describe(
406
- "A single-choice answer where the user selects one option from a list"
407
- );
408
- var MultipleChoiceAnswerSchema = z2.object({
409
- type: z2.literal("multiple_choice").describe("Indicates this is a multiple-choice answer"),
410
- selectedOptionIds: z2.array(z2.string()).describe(
411
- "Array of IDs for all selected options from the available choices"
412
- )
413
- }).describe(
414
- "A multiple-choice answer where the user can select multiple options from a list"
415
- );
416
- var ScaleAnswerSchema = z2.object({
417
- type: z2.literal("scale").describe("Indicates this is a scale/rating answer"),
418
- value: z2.number().describe(
419
- "The numerical value representing the position on the scale (e.g., 1-5, 1-10)"
420
- )
421
- }).describe(
422
- "A scale answer where the user selects a numerical value on a scale"
423
- );
424
- var ContinuousSumAnswerSchema = z2.object({
425
- type: z2.literal("continuous_sum").describe("Indicates this is a continuous sum answer"),
426
- values: z2.array(
427
- z2.object({
428
- optionId: z2.string().describe("The ID of the option being rated"),
429
- value: z2.number().describe("The numerical value assigned to this option")
430
- })
431
- ).describe(
432
- "Array of option-value pairs where the sum of all values represents a total allocation"
433
- )
434
- }).describe(
435
- "A continuous sum answer where users distribute values across multiple options that add up to a total"
436
- );
437
- var RankingAnswerSchema = z2.object({
438
- type: z2.literal("ranking").describe("Indicates this is a ranking answer"),
439
- ranks: z2.array(
440
- z2.object({
441
- optionId: z2.string().describe("The ID of the option being ranked"),
442
- rank: z2.number().describe(
443
- "The rank position of this option (lower numbers indicate higher preference)"
444
- )
445
- })
446
- ).describe(
447
- "Array of option-rank pairs showing the user's preference ordering"
396
+ var AnnotationMarkerSchema = z2.object({
397
+ marker_no: z2.string(),
398
+ timeline: z2.string(),
399
+ comment: z2.string()
400
+ });
401
+ var AnnotationSchema = z2.object({
402
+ file_type: z2.string(),
403
+ file_name: z2.string(),
404
+ markers: z2.array(AnnotationMarkerSchema)
405
+ });
406
+ var AnswerItemSchema = z2.object({
407
+ nps: z2.number().optional().describe("Net Promoter Score value (e.g., 0-10)"),
408
+ nested_selection: z2.array(z2.string()).optional().describe("Array of selected nested option IDs"),
409
+ long_text: z2.string().optional().describe("Long text answer, e.g., paragraph or essay"),
410
+ short_answer: z2.string().optional().describe("Short text answer, e.g., single sentence or word"),
411
+ single_choice: z2.string().optional().describe(
412
+ "single selected option ID (for single choice questions)"
413
+ ),
414
+ rating: z2.number().optional().describe("Star rating value (e.g., 1-5)"),
415
+ multiple_choice_multiple: z2.array(z2.string()).optional().describe("Array of selected option IDs for multiple choice questions"),
416
+ annotation: AnnotationSchema.optional().describe(
417
+ "Annotation object containing file and marker details"
418
+ ),
419
+ others: z2.string().optional().describe(
420
+ "For multiple choice questions and single choice questions, this is the value of the other option"
448
421
  )
449
422
  }).describe(
450
- "A ranking answer where users order options by preference or priority"
451
- );
452
- var TextAnswerSchema = z2.object({
453
- type: z2.literal("text").describe("Indicates this is a text-based answer"),
454
- values: z2.array(
455
- z2.object({
456
- fieldId: z2.string().describe("The ID of the text field"),
457
- text: z2.string().describe("The text content entered by the user")
458
- })
459
- ).describe("Array of field-text pairs for multiple text input fields")
460
- }).describe(
461
- "A text answer containing responses to one or more text input fields"
462
- );
463
- var AnswerSchema = z2.discriminatedUnion("type", [
464
- SimpleAnswerSchema,
465
- ChoiceAnswerSchema,
466
- MultipleChoiceAnswerSchema,
467
- ScaleAnswerSchema,
468
- ContinuousSumAnswerSchema,
469
- RankingAnswerSchema,
470
- TextAnswerSchema
471
- ]).describe(
472
- "A union of all possible answer types discriminated by the 'type' field"
423
+ "Flexible answer item supporting various question types and custom fields"
473
424
  );
425
+ var QuestionsResponseSchema = z2.object({
426
+ question_id: z2.string(),
427
+ error: z2.string().optional(),
428
+ answer: AnswerItemSchema,
429
+ type: z2.string()
430
+ });
431
+ var AnswerSchema = AnswerItemSchema;
474
432
 
475
433
  // src/schemas/fields/form-schema.ts
476
434
  import { z as z3 } from "zod";
@@ -1203,17 +1161,17 @@ var fetchConfigurationListResponseSchema = z12.object({
1203
1161
  // src/index.ts
1204
1162
  import { z as z13 } from "zod";
1205
1163
  export {
1164
+ AnnotationMarkerSchema,
1165
+ AnnotationSchema,
1166
+ AnswerItemSchema,
1206
1167
  AnswerSchema,
1207
- ChoiceAnswerSchema,
1208
1168
  ChoiceOrderOptions,
1209
- ContinuousSumAnswerSchema,
1210
1169
  DeviceThemes,
1211
1170
  DismissBehaviors,
1212
1171
  EndFieldsTranslationSchema,
1213
1172
  EndScreenFieldsSchema,
1214
1173
  LanguageFieldSchema,
1215
1174
  LanguagesSchema,
1216
- MultipleChoiceAnswerSchema,
1217
1175
  MultipleChoiceDisplayStyles,
1218
1176
  MultipleChoiceMultipleDisplayStyles,
1219
1177
  OtherFieldsSchema,
@@ -1222,14 +1180,11 @@ export {
1222
1180
  PublicationStatuses,
1223
1181
  QuestionStatuses,
1224
1182
  QuestionTypes,
1225
- RankingAnswerSchema,
1183
+ QuestionsResponseSchema,
1226
1184
  RatingDisplayStyles,
1227
1185
  RatingRepresentationSizes,
1228
1186
  RecurringUnits,
1229
- ScaleAnswerSchema,
1230
- SimpleAnswerSchema,
1231
1187
  SurveyTypes,
1232
- TextAnswerSchema,
1233
1188
  ThemeModes,
1234
1189
  TranslationProvider,
1235
1190
  UserActions,