@encatch/schema 1.0.1-beta.1 → 1.0.1-beta.2
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 +29 -98
- package/dist/esm/index.js.map +2 -2
- package/dist/types/index.d.ts +3 -3
- package/dist/types/schemas/api/fetch-feedback-schema.d.ts +276 -130
- package/dist/types/schemas/fields/app-props-schema.d.ts +138 -111
- package/dist/types/schemas/fields/field-schema.d.ts +300 -75
- package/dist/types/schemas/fields/form-properties-schema.d.ts +139 -189
- package/dist/types/schemas/fields/other-screen-schema.d.ts +0 -39
- package/dist/types/schemas/fields/translations-schema.d.ts +1 -77
- package/package.json +1 -1
package/dist/esm/index.js
CHANGED
|
@@ -18,7 +18,8 @@ var questionTypeSchema = z.enum([
|
|
|
18
18
|
"yes_no",
|
|
19
19
|
"rating_matrix",
|
|
20
20
|
"matrix_single_choice",
|
|
21
|
-
"matrix_multiple_choice"
|
|
21
|
+
"matrix_multiple_choice",
|
|
22
|
+
"exit_form"
|
|
22
23
|
]).describe("Enumeration of all supported question types for form fields");
|
|
23
24
|
var QuestionTypes = {
|
|
24
25
|
RATING: "rating",
|
|
@@ -35,7 +36,8 @@ var QuestionTypes = {
|
|
|
35
36
|
YES_NO: "yes_no",
|
|
36
37
|
RATING_MATRIX: "rating_matrix",
|
|
37
38
|
MATRIX_SINGLE_CHOICE: "matrix_single_choice",
|
|
38
|
-
MATRIX_MULTIPLE_CHOICE: "matrix_multiple_choice"
|
|
39
|
+
MATRIX_MULTIPLE_CHOICE: "matrix_multiple_choice",
|
|
40
|
+
EXIT_FORM: "exit_form"
|
|
39
41
|
};
|
|
40
42
|
var validationRuleTypeSchema = z.enum([
|
|
41
43
|
"required",
|
|
@@ -179,19 +181,19 @@ var questionSchema = z.object({
|
|
|
179
181
|
),
|
|
180
182
|
title: z.string().min(1).max(200).describe("The main title/question text displayed to users"),
|
|
181
183
|
description: z.string().max(1e3).optional().describe("Optional detailed description or help text"),
|
|
182
|
-
descriptionMarkdown: z.string().max(5e3).optional().describe("Optional description in Markdown format"),
|
|
183
184
|
describe: z.string().max(2e3).optional().describe(
|
|
184
185
|
"LLM tool call description for better AI understanding and context"
|
|
185
186
|
),
|
|
186
187
|
required: z.boolean().default(false).describe("Whether this question must be answered"),
|
|
188
|
+
isHidden: z.boolean().default(false).describe("When true, the question is hidden from the form UI"),
|
|
187
189
|
errorMessage: z.string().max(500).optional().describe("Custom error message when validation fails"),
|
|
188
190
|
validations: z.array(validationRuleSchema).optional().default([]).describe("Array of validation rules to apply"),
|
|
189
191
|
visibility: z.array(visibilityConditionSchema).optional().default([]).describe("Conditions that control when this question is shown"),
|
|
190
|
-
isFixed: z.boolean().describe("Whether this question position is fixed or can be reordered"),
|
|
191
192
|
sectionId: z.string().optional().describe("ID of the section this question belongs to"),
|
|
192
193
|
status: questionStatusSchema.describe(
|
|
193
194
|
"Current status of the question (Draft, Published, etc.)"
|
|
194
|
-
)
|
|
195
|
+
),
|
|
196
|
+
textAlign: z.enum(["left", "center"]).optional().default("left").describe("Text alignment for the question title and description")
|
|
195
197
|
}).describe("Base schema for all question types with common properties");
|
|
196
198
|
var ratingQuestionSchema = questionSchema.extend({
|
|
197
199
|
type: z.literal("rating").describe("Must be exactly 'rating'"),
|
|
@@ -221,12 +223,12 @@ var thankYouQuestionSchema = questionSchema.extend({
|
|
|
221
223
|
type: z.literal("thank_you").describe("Must be exactly 'thank_you'"),
|
|
222
224
|
title: z.string().min(1).max(200).describe("The main heading displayed on the thank you screen"),
|
|
223
225
|
description: z.string().max(1e3).optional().describe(
|
|
224
|
-
"Optional thank you body text
|
|
226
|
+
"Optional thank you body text; rendered as Markdown where the form supports it"
|
|
225
227
|
),
|
|
226
228
|
buttonLabel: z.string().min(1).max(50).optional().describe("Label for the dismiss/done button (e.g. 'Done', 'Close')"),
|
|
227
229
|
imageUrl: z.string().url().optional().describe("Optional image URL displayed on the thank you screen")
|
|
228
230
|
}).describe(
|
|
229
|
-
"Schema for a thank you screen shown at the end or inline within a form
|
|
231
|
+
"Schema for a thank you screen shown at the end or inline within a form"
|
|
230
232
|
);
|
|
231
233
|
var messagePanelQuestionSchema = questionSchema.extend({
|
|
232
234
|
type: z.literal("message_panel").describe("Must be exactly 'message_panel'"),
|
|
@@ -237,6 +239,11 @@ var messagePanelQuestionSchema = questionSchema.extend({
|
|
|
237
239
|
}).describe(
|
|
238
240
|
"Schema for an inline message panel (informational); distinct from welcome for UI semantics and analytics"
|
|
239
241
|
);
|
|
242
|
+
var exitFormQuestionSchema = questionSchema.extend({
|
|
243
|
+
type: z.literal("exit_form").describe("Must be exactly 'exit_form'")
|
|
244
|
+
}).describe(
|
|
245
|
+
"Schema for an exit marker that silently ends the survey; carries no UI and captures no answer \u2014 intended for branch logic paths that should terminate without showing a thank-you screen"
|
|
246
|
+
);
|
|
240
247
|
var yesNoQuestionSchema = questionSchema.extend({
|
|
241
248
|
type: z.literal("yes_no").describe("Must be exactly 'yes_no'"),
|
|
242
249
|
yesLabel: z.string().min(1).max(50).optional().describe("Label for the Yes option (defaults to 'Yes' in the UI if omitted)"),
|
|
@@ -268,23 +275,21 @@ var ratingMatrixScalePointSchema = z.object({
|
|
|
268
275
|
describe: z.string().max(500).optional().describe("LLM tool call description for this scale point")
|
|
269
276
|
}).describe("Schema for a single point on a custom rating scale");
|
|
270
277
|
var ratingMatrixScaleSchema = z.discriminatedUnion("kind", [
|
|
271
|
-
// Likert: symmetric ordinal scale -2…+2,
|
|
278
|
+
// Likert: symmetric ordinal scale -2…+2, explicit scale points with labels
|
|
272
279
|
z.object({
|
|
273
280
|
kind: z.literal("likert").describe("Symmetric ordinal scale (-2 to +2)"),
|
|
274
|
-
|
|
275
|
-
maxLabel: z.string().max(100).optional().describe("Optional label for the positive end of the Likert scale")
|
|
281
|
+
scalePoints: z.array(ratingMatrixScalePointSchema).min(2).max(10).describe("Scale points with display labels for each column")
|
|
276
282
|
}),
|
|
277
|
-
// Numerical: 1…N points where N is 2, 3, 4, or 5
|
|
283
|
+
// Numerical: 1…N points where N is 2, 3, 4, or 5, explicit scale points with labels
|
|
278
284
|
z.object({
|
|
279
|
-
kind: z.literal("numerical").describe("Numerical scale from 1 to N
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
maxLabel: z.string().max(100).optional().describe("Optional label for the highest numerical value")
|
|
285
|
+
kind: z.literal("numerical").describe("Numerical scale from 1 to N"),
|
|
286
|
+
scalePoints: z.array(ratingMatrixScalePointSchema).min(2).max(10).describe("Scale points with display labels for each column"),
|
|
287
|
+
pointCount: z.union([z.literal(2), z.literal(3), z.literal(4), z.literal(5)]).describe("Number of scale points (2, 3, 4, or 5)")
|
|
283
288
|
}),
|
|
284
289
|
// Custom: consumer defines each point's value and label
|
|
285
290
|
z.object({
|
|
286
291
|
kind: z.literal("custom").describe("Custom scale with user-defined points and values"),
|
|
287
|
-
scalePoints: z.array(ratingMatrixScalePointSchema).min(2).max(
|
|
292
|
+
scalePoints: z.array(ratingMatrixScalePointSchema).min(2).max(10).describe("Scale points with display labels for each column")
|
|
288
293
|
})
|
|
289
294
|
]).describe("Scale configuration for rating matrix questions");
|
|
290
295
|
var ratingMatrixQuestionSchema = questionSchema.extend({
|
|
@@ -541,6 +546,7 @@ var combinedQuestionSchema = z.discriminatedUnion("type", [
|
|
|
541
546
|
welcomeQuestionSchema,
|
|
542
547
|
thankYouQuestionSchema,
|
|
543
548
|
messagePanelQuestionSchema,
|
|
549
|
+
exitFormQuestionSchema,
|
|
544
550
|
yesNoQuestionSchema,
|
|
545
551
|
ratingMatrixQuestionSchema,
|
|
546
552
|
matrixSingleChoiceQuestionSchema,
|
|
@@ -586,13 +592,13 @@ var AnswerItemSchema = z2.object({
|
|
|
586
592
|
"Annotation object containing file and marker details"
|
|
587
593
|
),
|
|
588
594
|
ratingMatrix: z2.record(z2.string(), z2.union([z2.number(), z2.string()])).optional().describe(
|
|
589
|
-
"Rating matrix answers keyed by statement
|
|
595
|
+
"Rating matrix answers keyed by statement value (export key), value is the selected scale value (number for likert/numerical, string for custom)"
|
|
590
596
|
),
|
|
591
597
|
matrixSingleChoice: z2.record(z2.string(), z2.string()).optional().describe(
|
|
592
|
-
"Matrix single-choice answers keyed by row
|
|
598
|
+
"Matrix single-choice answers keyed by row value (export key), map value is the selected column option value"
|
|
593
599
|
),
|
|
594
600
|
matrixMultipleChoice: z2.record(z2.string(), z2.array(z2.string())).optional().describe(
|
|
595
|
-
"Matrix multiple-choice answers keyed by row
|
|
601
|
+
"Matrix multiple-choice answers keyed by row value (export key), map value is array of selected column option values"
|
|
596
602
|
),
|
|
597
603
|
others: z2.string().optional().describe(
|
|
598
604
|
"For multiple choice questions and single choice questions, this is the value of the other option"
|
|
@@ -722,14 +728,12 @@ var translationEntrySchema = z4.string().min(1).describe("Translated text conten
|
|
|
722
728
|
var baseQuestionTranslationFieldsSchema = z4.object({
|
|
723
729
|
title: translationEntrySchema.describe("Question title translation"),
|
|
724
730
|
description: translationEntrySchema.optional().describe("Question description translation"),
|
|
725
|
-
descriptionMarkdown: translationEntrySchema.optional().describe("Question description Markdown translation"),
|
|
726
731
|
errorMessage: translationEntrySchema.optional().describe("Error message translation")
|
|
727
732
|
});
|
|
728
733
|
var BASE_QUESTION_TRANSLATION_KEYS = [
|
|
729
734
|
"type",
|
|
730
735
|
"title",
|
|
731
736
|
"description",
|
|
732
|
-
"descriptionMarkdown",
|
|
733
737
|
"errorMessage"
|
|
734
738
|
];
|
|
735
739
|
var ratingQuestionTranslationSchema = baseQuestionTranslationFieldsSchema.extend({
|
|
@@ -987,33 +991,6 @@ __name(createTranslationProvider, "createTranslationProvider");
|
|
|
987
991
|
|
|
988
992
|
// src/schemas/fields/other-screen-schema.ts
|
|
989
993
|
import { z as z5 } from "zod";
|
|
990
|
-
var dismissBehaviorSchema = z5.enum(["fade", "manual"]).describe("How the end screen should be dismissed (fade out or manual dismissal)");
|
|
991
|
-
var DismissBehaviors = {
|
|
992
|
-
FADE: "fade",
|
|
993
|
-
MANUAL: "manual"
|
|
994
|
-
};
|
|
995
|
-
var WelcomeScreenFieldsSchema = z5.object({
|
|
996
|
-
title: z5.string().min(1).max(200).describe("The main title displayed on the welcome screen"),
|
|
997
|
-
description: z5.string().min(1).max(1e3).describe("Description text shown on the welcome screen"),
|
|
998
|
-
buttonLabel: z5.string().min(1).max(50).describe("Text displayed on the welcome screen button")
|
|
999
|
-
}).describe("Schema for welcome screen configuration fields");
|
|
1000
|
-
var EndScreenFieldsSchema = z5.object({
|
|
1001
|
-
title: z5.string().min(1).max(200).describe("The main title displayed on the end screen"),
|
|
1002
|
-
message: z5.string().min(1).max(1e3).describe("Message text shown on the end screen"),
|
|
1003
|
-
buttonLabel: z5.string().min(1).max(50).describe("Text displayed on the end screen button"),
|
|
1004
|
-
dismissBehavior: dismissBehaviorSchema.describe("How the end screen should be dismissed (fade out or manual dismissal)"),
|
|
1005
|
-
fadeDuration: z5.number().int().min(0).max(1e4).describe("Duration in milliseconds for fade dismissal (0-10000)")
|
|
1006
|
-
}).describe("Schema for end screen configuration fields");
|
|
1007
|
-
var WelcomeFieldsTranslationSchema = z5.object({
|
|
1008
|
-
title: z5.string().min(1).max(200).describe("Translated title text for welcome screen"),
|
|
1009
|
-
description: z5.string().min(1).max(1e3).describe("Translated description text for welcome screen"),
|
|
1010
|
-
buttonLabel: z5.string().min(1).max(50).describe("Translated text for the welcome button label")
|
|
1011
|
-
}).describe("Schema for welcome screen translation fields");
|
|
1012
|
-
var EndFieldsTranslationSchema = z5.object({
|
|
1013
|
-
buttonLabel: z5.string().min(1).max(50).describe("Translated text for the end button label"),
|
|
1014
|
-
title: z5.string().min(1).max(200).describe("Translated title text for end screen"),
|
|
1015
|
-
message: z5.string().min(1).max(1e3).describe("Translated message text for end screen")
|
|
1016
|
-
}).describe("Schema for end screen translation fields");
|
|
1017
994
|
var OtherFieldsSchema = z5.object({
|
|
1018
995
|
pagination: z5.boolean().describe("Whether to show pagination for multi-page forms"),
|
|
1019
996
|
questionNumber: z5.boolean().describe("Whether to display question numbers"),
|
|
@@ -1028,9 +1005,8 @@ var OtherFieldsSchema = z5.object({
|
|
|
1028
1005
|
}).describe("Schema for other form configuration fields");
|
|
1029
1006
|
var LanguageFieldSchema = z5.object({
|
|
1030
1007
|
value: z5.string().min(1).max(10).describe("Language code (e.g., 'en', 'es', 'fr')"),
|
|
1031
|
-
label: z5.string().min(1).max(50).describe("Display name for the language (e.g., 'English', 'Spanish', 'French')")
|
|
1032
|
-
|
|
1033
|
-
}).describe("Schema for individual language field with value, label, and fixed status");
|
|
1008
|
+
label: z5.string().min(1).max(50).describe("Display name for the language (e.g., 'English', 'Spanish', 'French')")
|
|
1009
|
+
}).describe("Schema for individual language field with value and label");
|
|
1034
1010
|
var LanguagesSchema = z5.array(LanguageFieldSchema).describe("Schema for array of available languages");
|
|
1035
1011
|
var OtherFieldsTranslationSchema = z5.object({
|
|
1036
1012
|
submitButtonLabel: z5.string().min(1).max(50).describe("Translated text for the submit button"),
|
|
@@ -1206,34 +1182,6 @@ var otherConfigurationPropertiesSchema = z8.discriminatedUnion("isEnabled", [
|
|
|
1206
1182
|
translations: z8.record(z8.string(), OtherFieldsTranslationSchema).describe("Translations for other configuration field labels and buttons keyed by language code")
|
|
1207
1183
|
})
|
|
1208
1184
|
]).describe("Schema for other configuration properties including fields and translations");
|
|
1209
|
-
var welcomeScreenPropertiesSchema = z8.discriminatedUnion("isEnabled", [
|
|
1210
|
-
// When welcome screen is disabled
|
|
1211
|
-
z8.object({
|
|
1212
|
-
isEnabled: z8.literal(false).describe("Whether welcome screen is enabled"),
|
|
1213
|
-
welcomeFields: WelcomeScreenFieldsSchema.optional().describe("Welcome screen configuration fields including title, description, and button label"),
|
|
1214
|
-
translations: z8.record(z8.string(), WelcomeFieldsTranslationSchema).optional().describe("Translations for welcome screen content keyed by language code")
|
|
1215
|
-
}),
|
|
1216
|
-
// When welcome screen is enabled
|
|
1217
|
-
z8.object({
|
|
1218
|
-
isEnabled: z8.literal(true).describe("Whether welcome screen is enabled"),
|
|
1219
|
-
welcomeFields: WelcomeScreenFieldsSchema.describe("Welcome screen configuration fields including title, description, and button label"),
|
|
1220
|
-
translations: z8.record(z8.string(), WelcomeFieldsTranslationSchema).describe("Translations for welcome screen content keyed by language code")
|
|
1221
|
-
})
|
|
1222
|
-
]).describe("Schema for welcome screen properties including fields and translations");
|
|
1223
|
-
var endScreenPropertiesSchema = z8.discriminatedUnion("isEnabled", [
|
|
1224
|
-
// When end screen is disabled
|
|
1225
|
-
z8.object({
|
|
1226
|
-
isEnabled: z8.literal(false).describe("Whether end screen is enabled"),
|
|
1227
|
-
endFields: EndScreenFieldsSchema.optional().describe("End screen configuration fields including title, message, button label, and dismissal behavior"),
|
|
1228
|
-
translations: z8.record(z8.string(), EndFieldsTranslationSchema).optional().describe("Translations for end screen content keyed by language code")
|
|
1229
|
-
}),
|
|
1230
|
-
// When end screen is enabled
|
|
1231
|
-
z8.object({
|
|
1232
|
-
isEnabled: z8.literal(true).describe("Whether end screen is enabled"),
|
|
1233
|
-
endFields: EndScreenFieldsSchema.describe("End screen configuration fields including title, message, button label, and dismissal behavior"),
|
|
1234
|
-
translations: z8.record(z8.string(), EndFieldsTranslationSchema).describe("Translations for end screen content keyed by language code")
|
|
1235
|
-
})
|
|
1236
|
-
]).describe("Schema for end screen properties including fields and translations");
|
|
1237
1185
|
var appearancePropertiesSchema = z8.object({
|
|
1238
1186
|
themeConfiguration: themeConfigurationSchema.describe("Theme configuration including colors, features, and positioning")
|
|
1239
1187
|
}).describe("Schema for appearance properties including theme configuration");
|
|
@@ -1250,10 +1198,8 @@ var formPropertiesSchema = z8.object({
|
|
|
1250
1198
|
externalPublishingProperties: externalPublishingPropertiesSchema.describe("Properties controlling external sharing and publishing of feedback results"),
|
|
1251
1199
|
audienceTriggerProperties: audienceTriggerPropertiesSchema.describe("Properties defining audience targeting and trigger conditions for the feedback form"),
|
|
1252
1200
|
otherConfigurationProperties: otherConfigurationPropertiesSchema.describe("Additional configuration properties including form display options and translations"),
|
|
1253
|
-
welcomeScreenProperties: welcomeScreenPropertiesSchema.describe("Welcome screen configuration including content and translations"),
|
|
1254
|
-
endScreenProperties: endScreenPropertiesSchema.describe("End screen configuration including content, dismissal behavior, and translations"),
|
|
1255
1201
|
appearanceProperties: appearancePropertiesSchema.describe("Appearance configuration including themes, colors, and UI feature settings")
|
|
1256
|
-
}).describe("Complete schema for all feedback-level properties including scheduling, publishing, audience targeting, configuration,
|
|
1202
|
+
}).describe("Complete schema for all feedback-level properties including scheduling, publishing, audience targeting, configuration, and appearance");
|
|
1257
1203
|
|
|
1258
1204
|
// src/schemas/fields/other-properties-schema.ts
|
|
1259
1205
|
import { z as z9 } from "zod";
|
|
@@ -1439,12 +1385,6 @@ var fetchFeedbackDetailsResponseSchema = z12.object({
|
|
|
1439
1385
|
otherConfigurationProperties: otherConfigurationPropertiesSchema.describe(
|
|
1440
1386
|
"Other configuration properties using existing schema"
|
|
1441
1387
|
),
|
|
1442
|
-
welcomeScreenProperties: welcomeScreenPropertiesSchema.describe(
|
|
1443
|
-
"Welcome screen properties using existing schema"
|
|
1444
|
-
),
|
|
1445
|
-
endScreenProperties: endScreenPropertiesSchema.describe(
|
|
1446
|
-
"End screen properties using existing schema"
|
|
1447
|
-
),
|
|
1448
1388
|
appearanceProperties: appearancePropertiesSchema.describe(
|
|
1449
1389
|
"Appearance properties including theme configuration"
|
|
1450
1390
|
)
|
|
@@ -1563,8 +1503,6 @@ var appPropsSchema = z14.object({
|
|
|
1563
1503
|
otherConfigurationProperties: otherConfigurationPropertiesSchema.describe(
|
|
1564
1504
|
"Other configuration properties including form display options and translations"
|
|
1565
1505
|
),
|
|
1566
|
-
welcomeScreenProperties: welcomeScreenPropertiesSchema.optional().describe("Welcome screen configuration (optional)"),
|
|
1567
|
-
endScreenProperties: endScreenPropertiesSchema.optional().describe("End screen configuration (optional)"),
|
|
1568
1506
|
translations: translationsSchema.optional().describe(
|
|
1569
1507
|
"Multi-language translations for questions and form content (optional)"
|
|
1570
1508
|
),
|
|
@@ -1596,9 +1534,6 @@ export {
|
|
|
1596
1534
|
ChoiceOrderOptions,
|
|
1597
1535
|
CurrentModes,
|
|
1598
1536
|
DeviceThemes,
|
|
1599
|
-
DismissBehaviors,
|
|
1600
|
-
EndFieldsTranslationSchema,
|
|
1601
|
-
EndScreenFieldsSchema,
|
|
1602
1537
|
LanguageFieldSchema,
|
|
1603
1538
|
LanguagesSchema,
|
|
1604
1539
|
MultipleChoiceDisplayStyles,
|
|
@@ -1619,8 +1554,6 @@ export {
|
|
|
1619
1554
|
TranslationProvider,
|
|
1620
1555
|
ValidationRuleTypes,
|
|
1621
1556
|
VisibilityConditionOperators,
|
|
1622
|
-
WelcomeFieldsTranslationSchema,
|
|
1623
|
-
WelcomeScreenFieldsSchema,
|
|
1624
1557
|
YesNoDisplayStyles,
|
|
1625
1558
|
YesNoValues,
|
|
1626
1559
|
annotationQuestionSchema,
|
|
@@ -1643,8 +1576,7 @@ export {
|
|
|
1643
1576
|
deviceInfoSchema,
|
|
1644
1577
|
deviceSessionInfoSchema,
|
|
1645
1578
|
deviceThemeSchema,
|
|
1646
|
-
|
|
1647
|
-
endScreenPropertiesSchema,
|
|
1579
|
+
exitFormQuestionSchema,
|
|
1648
1580
|
externalPublishingPropertiesSchema,
|
|
1649
1581
|
featureSettingsSchema,
|
|
1650
1582
|
feedbackConfigurationItemSchema,
|
|
@@ -1740,7 +1672,6 @@ export {
|
|
|
1740
1672
|
visibilityConditionSchema,
|
|
1741
1673
|
welcomeQuestionSchema,
|
|
1742
1674
|
welcomeQuestionTranslationSchema,
|
|
1743
|
-
welcomeScreenPropertiesSchema,
|
|
1744
1675
|
whoSchema,
|
|
1745
1676
|
yesNoDisplayStyleSchema,
|
|
1746
1677
|
yesNoQuestionSchema,
|