@encatch/schema 1.2.0-beta.3 → 1.2.0-beta.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.
package/dist/esm/index.js CHANGED
@@ -930,12 +930,12 @@ var csatQuestionSchema = questionSchema.extend({
930
930
  scale: csatScaleSchema.optional().default(5).describe("Number of response points (2\u20135); 2 and 4 have no neutral option, default is 5"),
931
931
  displayStyle: csatDisplayStyleSchema.optional().default("emoji").describe("How response options are rendered \u2014 emoji faces (default) or text buttons"),
932
932
  multicolor: z2.boolean().optional().default(false).describe("Whether to apply distinct colors to negative, neutral, and positive segments"),
933
- negativeColor: z2.string().max(50).optional().describe("Color for negative response options (semantic values -2, -1); any valid CSS color; used when multicolor is true"),
934
- neutralColor: z2.string().max(50).optional().describe("Color for the neutral response option (semantic value 0); any valid CSS color; used when multicolor is true"),
935
- positiveColor: z2.string().max(50).optional().describe("Color for positive response options (semantic values 1, 2); any valid CSS color; used when multicolor is true"),
933
+ negativeColor: z2.string().max(50).optional().describe("Color for negative response options (lower half of scale); any valid CSS color; used when multicolor is true"),
934
+ neutralColor: z2.string().max(50).optional().describe("Color for the neutral midpoint option (odd scales only: scale 3 = value 2, scale 5 = value 3); any valid CSS color; used when multicolor is true"),
935
+ positiveColor: z2.string().max(50).optional().describe("Color for positive response options (upper half of scale); any valid CSS color; used when multicolor is true"),
936
936
  showLabels: z2.boolean().optional().default(false).describe("Whether to render per-point labels below each response option"),
937
- scaleLabels: z2.record(z2.string(), z2.string().max(100)).optional().describe("Per-point label text keyed by semantic value string ('-2', '-1', '0', '1', '2')")
938
- }).describe("Schema for a CSAT (Customer Satisfaction Score) question using a 2\u20135 point semantic scale");
937
+ scaleLabels: z2.record(z2.string(), z2.string().max(100)).optional().describe("Per-point label text keyed by value string ('1'\u2013'5'); keys must match the chosen scale size")
938
+ }).describe("Schema for a CSAT (Customer Satisfaction Score) question using an industry-standard 1-to-N positive scale (N = 2\u20135)");
939
939
  var opinionScaleQuestionSchema = questionSchema.extend({
940
940
  type: z2.literal("opinion_scale").describe("Must be exactly 'opinion_scale'"),
941
941
  startValue: z2.union([z2.literal(0), z2.literal(1)]).optional().default(0).describe("Starting value of the scale \u2014 0 (default) or 1"),
@@ -1029,7 +1029,7 @@ var numberQuestionSchema = questionSchema.extend({
1029
1029
  allowNegative: z2.boolean().optional().default(false).describe("Whether negative values are accepted; Typeform restricts to positive numbers only, making this a differentiator"),
1030
1030
  placeholder: z2.string().max(200).optional().describe("Placeholder text shown inside the number input"),
1031
1031
  prepopulatedValue: z2.number().optional().describe("Default numeric value to pre-fill the input"),
1032
- unit: z2.string().max(20).optional().describe("Unit label displayed beside the input (e.g. 'kg', '$', 'years')")
1032
+ unit: z2.string().max(10).optional().describe("Unit label displayed beside the input (e.g. 'kg', '$', 'years')")
1033
1033
  }).refine(
1034
1034
  (data) => data.min === void 0 || data.max === void 0 || data.min <= data.max,
1035
1035
  {
@@ -1052,7 +1052,8 @@ var phoneNumberQuestionSchema = questionSchema.extend({
1052
1052
  var addressSubFieldConfigSchema = z2.object({
1053
1053
  enabled: z2.boolean().default(true).describe("Whether this sub-field is shown in the question"),
1054
1054
  required: z2.boolean().default(false).describe("Whether the respondent must fill in this sub-field"),
1055
- placeholder: z2.string().max(200).optional().describe("Placeholder text for this sub-field input")
1055
+ placeholder: z2.string().max(200).optional().describe("Placeholder text for this sub-field input"),
1056
+ label: z2.string().max(120).optional().describe("Visible caption above this sub-field; defaults to built-in copy when omitted")
1056
1057
  }).describe("Configuration for an individual address sub-field");
1057
1058
  var addressQuestionSchema = questionSchema.extend({
1058
1059
  type: z2.literal("address").describe("Must be exactly 'address'"),
@@ -1185,23 +1186,29 @@ var QnaWithAiPairSchema = z3.object({
1185
1186
  answer: z3.string().describe("The AI-generated answer based on the knowledge base")
1186
1187
  }).describe("A single Q&A exchange between the respondent and the AI");
1187
1188
  var QnaWithAiAnswerSchema = z3.array(QnaWithAiPairSchema).describe("Answer for a qna_with_ai question; ordered transcript of Q&A pairs from the session");
1188
- var SchedulerAnswerSchema = z3.object({
1189
- provider: z3.enum(["google_calendar", "calendly"]).describe("The calendar integration used to make the booking"),
1190
- slotStart: z3.string().describe("ISO 8601 datetime of the booked slot start (e.g. '2026-05-15T14:00:00Z')"),
1191
- slotEnd: z3.string().describe("ISO 8601 datetime of the booked slot end (e.g. '2026-05-15T14:30:00Z')"),
1192
- eventId: z3.string().optional().describe("Calendar event ID (Google Calendar) or Calendly event UUID"),
1193
- bookedAt: z3.string().describe("ISO 8601 datetime when the respondent completed the booking")
1194
- }).describe("Answer for a scheduler question");
1189
+ var SchedulerAnswerSchema = z3.discriminatedUnion("provider", [
1190
+ z3.object({
1191
+ provider: z3.literal("google_calendar").describe("The calendar integration used to make the booking"),
1192
+ bookedAt: z3.string().describe("Unix timestamp in seconds as a string when the respondent confirmed the booking")
1193
+ }),
1194
+ z3.object({
1195
+ provider: z3.literal("calendly").describe("The calendar integration used to make the booking"),
1196
+ slotStart: z3.string().describe("ISO 8601 datetime of the booked slot start (e.g. '2026-05-15T14:00:00Z')"),
1197
+ slotEnd: z3.string().describe("ISO 8601 datetime of the booked slot end (e.g. '2026-05-15T14:30:00Z')"),
1198
+ eventId: z3.string().optional().describe("Calendly event UUID"),
1199
+ bookedAt: z3.string().describe("Unix timestamp in seconds as a string when the respondent completed the booking")
1200
+ })
1201
+ ]).describe("Answer for a scheduler question");
1195
1202
  var AnswerItemSchema = z3.object({
1196
1203
  nps: z3.number().optional().describe("Net Promoter Score value (e.g., 0-10)"),
1197
1204
  nestedSelection: z3.array(z3.string()).optional().describe("Array of selected nested option IDs"),
1198
1205
  longText: z3.string().optional().describe("Long text answer, e.g., paragraph or essay"),
1199
1206
  shortAnswer: z3.string().optional().describe("Short text answer, e.g., single sentence or word"),
1200
- singleChoice: z3.string().optional().describe("single selected option ID (for single choice questions)"),
1207
+ singleChoice: z3.string().optional().describe("Single selected option value for single choice questions"),
1201
1208
  rating: z3.number().optional().describe("Star rating value (e.g., 1-5)"),
1202
1209
  yesNo: z3.boolean().optional().describe("Yes/no answer for yes_no questions (true = Yes, false = No)"),
1203
1210
  consent: z3.boolean().optional().describe("Consent answer for consent questions (true = checked/agreed, false = unchecked)"),
1204
- multipleChoiceMultiple: z3.array(z3.string()).optional().describe("Array of selected option IDs for multiple choice questions"),
1211
+ multipleChoiceMultiple: z3.array(z3.string()).optional().describe("Array of selected option values for multiple choice questions"),
1205
1212
  singleChoiceOther: z3.string().optional().describe('Free-text "other" answer for single choice questions when allowOther is enabled'),
1206
1213
  multipleChoiceOther: z3.string().optional().describe('Free-text "other" answer for multiple choice questions when allowOther is enabled'),
1207
1214
  annotation: AnnotationSchema.optional().describe(
@@ -1222,15 +1229,14 @@ var AnswerItemSchema = z3.object({
1222
1229
  // Date question
1223
1230
  date: z3.string().optional().describe("Answer for a date question; ISO 8601 format (YYYY-MM-DD or YYYY-MM-DDTHH:MM)"),
1224
1231
  // CSAT question
1225
- csat: z3.number().optional().describe("Answer for a CSAT question; semantic value: -2, -1, 0, 1, or 2"),
1232
+ csat: z3.number().optional().describe("Answer for a CSAT question; industry-standard value: 1 (lowest/worst) to N (highest/best) where N is the scale size (2\u20135)"),
1226
1233
  // Opinion scale question
1227
1234
  opinionScale: z3.number().optional().describe("Answer for an opinion scale question; the selected numeric value on the scale"),
1228
- // Ranking question — ordered array of option IDs; index 0 = rank 1
1229
- ranking: z3.array(z3.string()).optional().describe("Answer for a ranking question; ordered array of option IDs where index 0 is rank 1"),
1230
- // Picture choice — single selection
1231
- pictureChoice: z3.string().optional().describe("Answer for a picture choice question (single selection); the selected option ID"),
1232
- // Picture choice multiple selection
1233
- pictureChoiceMultiple: z3.array(z3.string()).optional().describe("Answer for a picture choice question (multiple selection); array of selected option IDs"),
1235
+ // Ranking question — ordered array of option values; index 0 = rank 1
1236
+ ranking: z3.array(z3.string()).optional().describe("Answer for a ranking question; ordered array of option values where index 0 is rank 1"),
1237
+ // Picture choice — always an array of selected option values (single selection = one-element array)
1238
+ pictureChoice: z3.array(z3.string()).optional().describe("Answer for a picture choice question; array of selected option values (single selection produces a one-element array)"),
1239
+ pictureChoiceOther: z3.string().optional().describe('Free-text "other" answer for picture choice questions when allowOther is enabled'),
1234
1240
  // Signature question
1235
1241
  signature: SignatureAnswerSchema.optional().describe("Answer for a signature question"),
1236
1242
  // File upload question
@@ -1238,7 +1244,7 @@ var AnswerItemSchema = z3.object({
1238
1244
  // Email question
1239
1245
  email: z3.string().optional().describe("Answer for an email question; the submitted email address"),
1240
1246
  // Number question
1241
- number: z3.number().optional().describe("Answer for a number question; the submitted numeric value"),
1247
+ number: z3.string().optional().describe("Answer for a number question; the submitted numeric value as a string"),
1242
1248
  // Website question
1243
1249
  website: z3.string().optional().describe("Answer for a website question; the submitted URL"),
1244
1250
  // Phone number question