@encatch/schema 0.1.24 → 0.1.26

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
@@ -422,12 +422,6 @@ var AnswerItemSchema = z2.object({
422
422
  }).describe(
423
423
  "Flexible answer item supporting various question types and custom fields"
424
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
425
  var AnswerSchema = AnswerItemSchema;
432
426
 
433
427
  // src/schemas/fields/form-schema.ts
@@ -1004,28 +998,35 @@ var DeviceThemes = {
1004
998
  SYSTEM: "system"
1005
999
  };
1006
1000
  var deviceInfoSchema = z10.object({
1007
- deviceType: z10.string().describe("Type of device being used"),
1008
- timezone: z10.string().describe("Device timezone (e.g., 'Asia/Calcutta')"),
1009
- theme: deviceThemeSchema.describe("Current theme mode preference"),
1010
- os: z10.string().describe("Operating system running on the device"),
1011
- osVersion: z10.string().describe("Version of the operating system"),
1012
- appVersion: z10.string().describe("Version of the application"),
1013
- app: z10.string().describe("Browser or application being used"),
1014
- language: z10.string().describe("Language preference (e.g., 'en-GB')")
1001
+ $deviceType: z10.string().describe("Type of device being used"),
1002
+ $timezone: z10.string().describe("Device timezone (e.g., 'Asia/Calcutta')"),
1003
+ $theme: deviceThemeSchema.describe("Current theme mode preference"),
1004
+ $os: z10.string().describe("Operating system running on the device"),
1005
+ $osVersion: z10.string().describe("Version of the operating system"),
1006
+ $appVersion: z10.string().describe("Version of the application"),
1007
+ $app: z10.string().describe("Browser or application being used"),
1008
+ $language: z10.string().describe("Language preference (e.g., 'en-GB')")
1015
1009
  }).describe("Device information collected from the client");
1016
1010
  var sessionInfoSchema = z10.object({
1017
- sessionId: z10.string().uuid().describe("Unique session identifier")
1011
+ $sessionId: z10.string().uuid().describe("Unique session identifier"),
1012
+ $timestamp: z10.string().optional().describe("ISO timestamp of the session")
1018
1013
  }).describe("Session information for tracking user sessions");
1019
1014
  var deviceSessionInfoSchema = z10.object({
1020
1015
  deviceInfo: deviceInfoSchema.describe("Device information"),
1021
1016
  sessionInfo: sessionInfoSchema.describe("Session information")
1022
1017
  }).describe("Combined device and session information");
1023
1018
  var userPropertiesSchema = z10.object({
1024
- $counter: z10.record(z10.string(), z10.number().int()).describe("Counter properties for user tracking (can be positive or negative)").optional(),
1019
+ $counter: z10.record(z10.string(), z10.number().int()).describe(
1020
+ "Counter properties for user tracking (can be positive or negative)"
1021
+ ).optional(),
1025
1022
  $set: z10.record(z10.string(), z10.any()).describe("Properties to set for the user").optional(),
1026
- $setOnce: z10.record(z10.string(), z10.any()).describe("Properties to set once for the user (won't overwrite existing values)").optional(),
1023
+ $setOnce: z10.record(z10.string(), z10.any()).describe(
1024
+ "Properties to set once for the user (won't overwrite existing values)"
1025
+ ).optional(),
1027
1026
  $unset: z10.array(z10.string()).describe("Array of property names to unset/remove from the user").optional()
1028
- }).passthrough().describe("User properties including counters, set operations, and other dynamic data");
1027
+ }).loose().describe(
1028
+ "User properties including counters, set operations, and other dynamic data"
1029
+ );
1029
1030
  var userInfoSchema = z10.object({
1030
1031
  userName: z10.string().email().describe("User's email address as username"),
1031
1032
  properties: userPropertiesSchema.describe("User properties and counters")
@@ -1158,8 +1159,91 @@ var fetchConfigurationListResponseSchema = z12.object({
1158
1159
  feedbackConfiguration: z12.array(feedbackConfigurationItemSchema).describe("Array of available feedback configurations")
1159
1160
  }).strict().describe("Response schema for fetchConfigurationList API");
1160
1161
 
1161
- // src/index.ts
1162
+ // src/schemas/api/refine-text-schema.ts
1162
1163
  import { z as z13 } from "zod";
1164
+ var refineTextParamsSchema = z13.object({
1165
+ question_id: z13.string().describe("Unique identifier for the question"),
1166
+ identifier: z13.string().uuid().describe("Unique identifier for the feedback instance"),
1167
+ feedback_configuration_id: z13.string().uuid().describe("Unique identifier for the feedback configuration"),
1168
+ user_text: z13.string().describe("Original text input from the user")
1169
+ }).strict().describe("Request schema for refining user text input");
1170
+ var refineTextDataSchema = z13.object({
1171
+ user_text: z13.string().describe("Original text input from the user"),
1172
+ refined_text: z13.string().describe("Refined/improved version of the user text")
1173
+ }).describe("Data containing original and refined text");
1174
+ var refineTextResponseSchema = z13.object({
1175
+ success: z13.boolean().describe("Indicates whether the operation was successful"),
1176
+ code: z13.string().describe("Response code indicating the status"),
1177
+ message: z13.string().describe("Human-readable message describing the result"),
1178
+ messageId: z13.string().describe("Unique identifier for the response message"),
1179
+ data: refineTextDataSchema.describe("Response data containing original and refined text"),
1180
+ error: z13.string().optional().describe("Error message if the operation failed (optional)")
1181
+ }).strict().describe("Response schema for refine text API operation");
1182
+
1183
+ // src/helpers/case-convert-helper.ts
1184
+ function convertObject(obj, keyConverter) {
1185
+ if (obj === null || typeof obj === "undefined" || typeof obj !== "object") {
1186
+ return obj;
1187
+ }
1188
+ const out = Array.isArray(obj) ? [] : {};
1189
+ for (const [k, v] of Object.entries(obj)) {
1190
+ let newKey = k;
1191
+ if (typeof k === "string" && !k.includes("-")) {
1192
+ newKey = keyConverter(k);
1193
+ }
1194
+ out[newKey] = Array.isArray(v) ? v.map(
1195
+ (item) => typeof item === "object" && !(item instanceof Uint8Array) && !(item instanceof Date) ? convertObject(item, keyConverter) : item
1196
+ ) : v instanceof Uint8Array || v instanceof Date ? v : typeof v === "object" ? convertObject(v, keyConverter) : v;
1197
+ }
1198
+ return out;
1199
+ }
1200
+ __name(convertObject, "convertObject");
1201
+ function toCamel(term) {
1202
+ return term.length === 1 ? term.toLowerCase() : term.replace(/^([A-Z])/, (m) => m[0].toLowerCase()).replace(/[_-]([a-z0-9])/g, (m) => m[1].toUpperCase());
1203
+ }
1204
+ __name(toCamel, "toCamel");
1205
+ function objectToCamel(obj) {
1206
+ return convertObject(obj, toCamel);
1207
+ }
1208
+ __name(objectToCamel, "objectToCamel");
1209
+ function toSnake(term) {
1210
+ let result = term;
1211
+ let circuitBreaker = 0;
1212
+ while ((/([a-z])([0-9])/.exec(result)?.length || 0) > 2 && circuitBreaker < 10) {
1213
+ result = result.replace(
1214
+ /([a-z])([0-9])/,
1215
+ (_all, $1, $2) => `${$1.toLowerCase()}_${$2.toLowerCase()}`
1216
+ );
1217
+ circuitBreaker += 1;
1218
+ }
1219
+ while ((/(.+?)([A-Z])/.exec(result)?.length || 0) > 2 && circuitBreaker < 10) {
1220
+ result = result.replace(
1221
+ /(.+?)([A-Z])/,
1222
+ (_all, $1, $2) => `${$1.toLowerCase()}_${$2.toLowerCase()}`
1223
+ );
1224
+ circuitBreaker += 1;
1225
+ }
1226
+ return result.toLowerCase();
1227
+ }
1228
+ __name(toSnake, "toSnake");
1229
+ function objectToSnake(obj) {
1230
+ return convertObject(obj, toSnake);
1231
+ }
1232
+ __name(objectToSnake, "objectToSnake");
1233
+ function toPascal(term) {
1234
+ return toCamel(term).replace(
1235
+ /^([a-z])/,
1236
+ (m) => m[0].toUpperCase()
1237
+ );
1238
+ }
1239
+ __name(toPascal, "toPascal");
1240
+ function objectToPascal(obj) {
1241
+ return convertObject(obj, toPascal);
1242
+ }
1243
+ __name(objectToPascal, "objectToPascal");
1244
+
1245
+ // src/index.ts
1246
+ import { z as z14 } from "zod";
1163
1247
  export {
1164
1248
  AnnotationMarkerSchema,
1165
1249
  AnnotationSchema,
@@ -1180,7 +1264,6 @@ export {
1180
1264
  PublicationStatuses,
1181
1265
  QuestionStatuses,
1182
1266
  QuestionTypes,
1183
- QuestionsResponseSchema,
1184
1267
  RatingDisplayStyles,
1185
1268
  RatingRepresentationSizes,
1186
1269
  RecurringUnits,
@@ -1242,6 +1325,9 @@ export {
1242
1325
  nestedSelectionQuestionTranslationSchema,
1243
1326
  npsQuestionSchema,
1244
1327
  npsQuestionTranslationSchema,
1328
+ objectToCamel,
1329
+ objectToPascal,
1330
+ objectToSnake,
1245
1331
  otherConfigurationPropertiesSchema,
1246
1332
  positionSchema,
1247
1333
  publicationStatusSchema,
@@ -1259,6 +1345,9 @@ export {
1259
1345
  ratingQuestionTranslationSchema,
1260
1346
  ratingRepresentationSizeSchema,
1261
1347
  recurringUnitSchema,
1348
+ refineTextDataSchema,
1349
+ refineTextParamsSchema,
1350
+ refineTextResponseSchema,
1262
1351
  responseSchema,
1263
1352
  sectionSchema,
1264
1353
  sessionInfoSchema,
@@ -1271,6 +1360,9 @@ export {
1271
1360
  themeConfigurationSchema,
1272
1361
  themeModeSchema,
1273
1362
  themesSchema,
1363
+ toCamel,
1364
+ toPascal,
1365
+ toSnake,
1274
1366
  translationEntrySchema,
1275
1367
  translationsSchema,
1276
1368
  triggerActionSchema,
@@ -1284,6 +1376,6 @@ export {
1284
1376
  welcomeScreenPropertiesSchema,
1285
1377
  whoSchema,
1286
1378
  yesNoSchema,
1287
- z13 as z
1379
+ z14 as z
1288
1380
  };
1289
1381
  //# sourceMappingURL=index.js.map