@tellescope/validation 1.225.0 → 1.227.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.
- package/lib/cjs/validation.d.ts +79 -1
- package/lib/cjs/validation.d.ts.map +1 -1
- package/lib/cjs/validation.js +112 -9
- package/lib/cjs/validation.js.map +1 -1
- package/lib/esm/validation.d.ts +79 -1
- package/lib/esm/validation.d.ts.map +1 -1
- package/lib/esm/validation.js +105 -2
- package/lib/esm/validation.js.map +1 -1
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/package.json +7 -7
- package/src/validation.ts +114 -7
package/lib/esm/validation.js
CHANGED
|
@@ -858,6 +858,10 @@ export var positiveNumberValidator = numberValidatorBuilder({ lower: 1, upper: 1
|
|
|
858
858
|
export var numberValidator = numberValidatorBuilder({ lower: -10000000000000, upper: 10000000000000 }); // max is 2286 in UTC MS
|
|
859
859
|
export var numberValidatorOptional = numberValidatorBuilder({ lower: -10000000000000, upper: 10000000000000, isOptional: true, emptyStringOk: true }); // max is 2286 in UTC MS
|
|
860
860
|
export var listOfNumbersValidatorUniqueOptionalOrEmptyOkay = listValidatorUniqueOptionalEmptyOkay(numberValidator, { isNumber: true });
|
|
861
|
+
// Day of month and time validators for automation events
|
|
862
|
+
export var numberValidatorMin1Max31 = numberValidatorBuilder({ lower: 1, upper: 31 });
|
|
863
|
+
export var numberValidatorMin0Max23Optional = numberValidatorBuilder({ lower: 0, upper: 23, isOptional: true });
|
|
864
|
+
export var numberValidatorMin0Max59Optional = numberValidatorBuilder({ lower: 0, upper: 59, isOptional: true });
|
|
861
865
|
export var fileSizeValidator = numberValidatorBuilder({ lower: 0, upper: MAX_FILE_SIZE });
|
|
862
866
|
export var numberOrStringValidatorEmptyOkay = orValidator({
|
|
863
867
|
number: numberValidator,
|
|
@@ -1223,13 +1227,14 @@ export var FORM_FIELD_VALIDATORS_BY_TYPE = {
|
|
|
1223
1227
|
throw new Error('At least 1 choice is required');
|
|
1224
1228
|
}
|
|
1225
1229
|
var parsed = [];
|
|
1230
|
+
var choices = fieldOptions.choices || [];
|
|
1226
1231
|
for (var _i = 0, indexes_1 = indexes; _i < indexes_1.length; _i++) {
|
|
1227
1232
|
var i = indexes_1[_i];
|
|
1228
1233
|
if (typeof i !== 'number')
|
|
1229
1234
|
throw new Error("Choice ".concat(i, " is not a valid index"));
|
|
1230
|
-
if (i < 0 || i >=
|
|
1235
|
+
if (i < 0 || i >= choices.length)
|
|
1231
1236
|
throw new Error("Choice ".concat(i, " is not a valid index"));
|
|
1232
|
-
parsed.push(
|
|
1237
|
+
parsed.push(choices[i]);
|
|
1233
1238
|
}
|
|
1234
1239
|
if (otherText && fieldOptions.other === true)
|
|
1235
1240
|
parsed.push(otherText);
|
|
@@ -2092,6 +2097,10 @@ export var automationEventValidator = orValidator({
|
|
|
2092
2097
|
before: booleanValidatorOptional,
|
|
2093
2098
|
}, { isOptional: true, emptyOk: true, }), eventCondition: objectValidator({
|
|
2094
2099
|
before: booleanValidatorOptional,
|
|
2100
|
+
}, { isOptional: true, emptyOk: true }), dayOfMonthCondition: objectValidator({
|
|
2101
|
+
dayOfMonth: numberValidatorMin1Max31,
|
|
2102
|
+
hour: numberValidatorMin0Max23Optional,
|
|
2103
|
+
minute: numberValidatorMin0Max59Optional,
|
|
2095
2104
|
}, { isOptional: true, emptyOk: true }), skipIfDelayPassed: booleanValidatorOptional }), { emptyOk: false }),
|
|
2096
2105
|
}),
|
|
2097
2106
|
formUnsubmitted: objectValidator({
|
|
@@ -2604,6 +2613,7 @@ export var portalSettingsValidator = objectValidator({
|
|
|
2604
2613
|
loginDescription: stringValidator1000Optional,
|
|
2605
2614
|
loginGraphic: stringValidator1000Optional,
|
|
2606
2615
|
loginTitle: stringValidator1000Optional,
|
|
2616
|
+
loginBottomHTML: stringValidator5000OptionalEmptyOkay,
|
|
2607
2617
|
registerDescription: stringValidator1000Optional,
|
|
2608
2618
|
registerGraphic: stringValidator1000Optional,
|
|
2609
2619
|
registerTitle: stringValidator1000Optional,
|
|
@@ -2744,11 +2754,16 @@ export var formFieldFeedbackValidator = objectValidator({
|
|
|
2744
2754
|
ifEquals: stringValidator,
|
|
2745
2755
|
display: stringValidator,
|
|
2746
2756
|
});
|
|
2757
|
+
export var formFieldOptionDetailsValidator = objectValidator({
|
|
2758
|
+
option: stringValidator,
|
|
2759
|
+
description: stringValidator5000Optional,
|
|
2760
|
+
});
|
|
2747
2761
|
export var formFieldOptionsValidator = objectValidator({
|
|
2748
2762
|
default: stringValidatorOptional,
|
|
2749
2763
|
bookingPageId: stringValidatorOptional,
|
|
2750
2764
|
tableChoices: listValidatorOptionalOrEmptyOk(tableInputChoiceValidator),
|
|
2751
2765
|
choices: listOfStringsValidatorOptionalOrEmptyOk,
|
|
2766
|
+
optionDetails: listValidatorOptionalOrEmptyOk(formFieldOptionDetailsValidator),
|
|
2752
2767
|
radioChoices: listOfStringsValidatorOptionalOrEmptyOk,
|
|
2753
2768
|
canvasCodings: listValidatorOptionalOrEmptyOk(canvasCodingValidator),
|
|
2754
2769
|
from: numberValidatorOptional,
|
|
@@ -2771,6 +2786,7 @@ export var formFieldOptionsValidator = objectValidator({
|
|
|
2771
2786
|
databaseId: mongoIdStringOptional,
|
|
2772
2787
|
databaseLabel: stringValidatorOptionalEmptyOkay,
|
|
2773
2788
|
databaseLabels: listOfStringsValidatorOptionalOrEmptyOk,
|
|
2789
|
+
filterByEnduserState: booleanValidatorOptional,
|
|
2774
2790
|
databaseFilter: objectValidator({
|
|
2775
2791
|
databaseLabel: stringValidator1000Optional,
|
|
2776
2792
|
fieldId: mongoIdStringOptional,
|
|
@@ -2818,6 +2834,7 @@ export var formFieldOptionsValidator = objectValidator({
|
|
|
2818
2834
|
max: numberValidatorOptional,
|
|
2819
2835
|
min: numberValidatorOptional,
|
|
2820
2836
|
stripeKey: stringValidatorOptionalEmptyOkay,
|
|
2837
|
+
stripeProductSelectionMode: booleanValidatorOptional,
|
|
2821
2838
|
dataSource: stringValidatorOptionalEmptyOkay,
|
|
2822
2839
|
esignatureTermsCompanyName: stringValidatorOptionalEmptyOkay,
|
|
2823
2840
|
observationCode: stringValidatorOptionalEmptyOkay,
|
|
@@ -3183,6 +3200,7 @@ export var portalBlockValidator = orValidator({
|
|
|
3183
3200
|
title: stringValidator,
|
|
3184
3201
|
roles: listOfStringsValidatorOptionalOrEmptyOk,
|
|
3185
3202
|
showAll: booleanValidatorOptional,
|
|
3203
|
+
hideContactButton: booleanValidatorOptional,
|
|
3186
3204
|
// members: listValidatorEmptyOk(
|
|
3187
3205
|
// objectValidator<CareTeamMemberPortalCustomizationInfo>({
|
|
3188
3206
|
// title: stringValidator(),
|
|
@@ -3266,6 +3284,25 @@ export var baseAvailabilityBlockValidator = objectValidator({
|
|
|
3266
3284
|
externalId: stringValidatorOptionalEmptyOkay,
|
|
3267
3285
|
});
|
|
3268
3286
|
export var baseAvailabilityBlocksValidator = listValidatorEmptyOk(baseAvailabilityBlockValidator);
|
|
3287
|
+
var monthlyOccurrenceValidator = {
|
|
3288
|
+
validate: function (o) {
|
|
3289
|
+
if (o === void 0) { o = {}; }
|
|
3290
|
+
return build_validator(function (value) {
|
|
3291
|
+
if (![1, 2, 3, 4, 5].includes(value)) {
|
|
3292
|
+
throw new Error("Value must be one of 1, 2, 3, 4, 5");
|
|
3293
|
+
}
|
|
3294
|
+
return value;
|
|
3295
|
+
}, __assign(__assign({}, o), { listOf: false }));
|
|
3296
|
+
},
|
|
3297
|
+
getExample: function () { return 1; },
|
|
3298
|
+
getType: getTypeString,
|
|
3299
|
+
};
|
|
3300
|
+
export var monthlyRestrictionValidator = objectValidator({
|
|
3301
|
+
occurrences: listValidator(monthlyOccurrenceValidator),
|
|
3302
|
+
});
|
|
3303
|
+
export var monthlyRestrictionOptionalValidator = objectValidator({
|
|
3304
|
+
occurrences: listValidator(monthlyOccurrenceValidator),
|
|
3305
|
+
}, { isOptional: true, emptyOk: true });
|
|
3269
3306
|
export var weeklyAvailabilityValidator = objectValidator({
|
|
3270
3307
|
dayOfWeekStartingSundayIndexedByZero: nonNegNumberValidator,
|
|
3271
3308
|
endTimeInMinutes: nonNegNumberValidator,
|
|
@@ -3277,6 +3314,7 @@ export var weeklyAvailabilityValidator = objectValidator({
|
|
|
3277
3314
|
intervalInMinutes: numberValidatorOptional,
|
|
3278
3315
|
priority: numberValidatorOptional,
|
|
3279
3316
|
bufferStartMinutes: numberValidatorOptional,
|
|
3317
|
+
monthlyRestriction: monthlyRestrictionOptionalValidator,
|
|
3280
3318
|
});
|
|
3281
3319
|
export var weeklyAvailabilitiesValidator = listValidatorEmptyOk(weeklyAvailabilityValidator);
|
|
3282
3320
|
export var timezoneValidator = exactMatchValidator(Object.keys(TIMEZONE_MAP));
|
|
@@ -3321,6 +3359,7 @@ export var customEnduserFieldValidator = orValidator({
|
|
|
3321
3359
|
required: booleanValidatorOptional,
|
|
3322
3360
|
hiddenFromProfile: booleanValidatorOptional,
|
|
3323
3361
|
requireConfirmation: booleanValidatorOptional,
|
|
3362
|
+
tags: listOfStringsValidatorOptionalOrEmptyOk,
|
|
3324
3363
|
}),
|
|
3325
3364
|
"Multiple Select": objectValidator({
|
|
3326
3365
|
type: exactMatchValidator(['Multiple Select']),
|
|
@@ -3331,6 +3370,7 @@ export var customEnduserFieldValidator = orValidator({
|
|
|
3331
3370
|
required: booleanValidatorOptional,
|
|
3332
3371
|
hiddenFromProfile: booleanValidatorOptional,
|
|
3333
3372
|
requireConfirmation: booleanValidatorOptional,
|
|
3373
|
+
tags: listOfStringsValidatorOptionalOrEmptyOk,
|
|
3334
3374
|
}),
|
|
3335
3375
|
Text: objectValidator({
|
|
3336
3376
|
type: exactMatchValidator(['Text']),
|
|
@@ -3339,6 +3379,7 @@ export var customEnduserFieldValidator = orValidator({
|
|
|
3339
3379
|
required: booleanValidatorOptional,
|
|
3340
3380
|
hiddenFromProfile: booleanValidatorOptional,
|
|
3341
3381
|
requireConfirmation: booleanValidatorOptional,
|
|
3382
|
+
tags: listOfStringsValidatorOptionalOrEmptyOk,
|
|
3342
3383
|
}),
|
|
3343
3384
|
Number: objectValidator({
|
|
3344
3385
|
type: exactMatchValidator(['Number']),
|
|
@@ -3347,6 +3388,7 @@ export var customEnduserFieldValidator = orValidator({
|
|
|
3347
3388
|
required: booleanValidatorOptional,
|
|
3348
3389
|
hiddenFromProfile: booleanValidatorOptional,
|
|
3349
3390
|
requireConfirmation: booleanValidatorOptional,
|
|
3391
|
+
tags: listOfStringsValidatorOptionalOrEmptyOk,
|
|
3350
3392
|
}),
|
|
3351
3393
|
File: objectValidator({
|
|
3352
3394
|
type: exactMatchValidator(['File']),
|
|
@@ -3355,6 +3397,7 @@ export var customEnduserFieldValidator = orValidator({
|
|
|
3355
3397
|
required: booleanValidatorOptional,
|
|
3356
3398
|
hiddenFromProfile: booleanValidatorOptional,
|
|
3357
3399
|
requireConfirmation: booleanValidatorOptional,
|
|
3400
|
+
tags: listOfStringsValidatorOptionalOrEmptyOk,
|
|
3358
3401
|
}),
|
|
3359
3402
|
"Multiple Text": objectValidator({
|
|
3360
3403
|
type: exactMatchValidator(["Multiple Text"]),
|
|
@@ -3363,6 +3406,7 @@ export var customEnduserFieldValidator = orValidator({
|
|
|
3363
3406
|
required: booleanValidatorOptional,
|
|
3364
3407
|
hiddenFromProfile: booleanValidatorOptional,
|
|
3365
3408
|
requireConfirmation: booleanValidatorOptional,
|
|
3409
|
+
tags: listOfStringsValidatorOptionalOrEmptyOk,
|
|
3366
3410
|
}),
|
|
3367
3411
|
Date: objectValidator({
|
|
3368
3412
|
type: exactMatchValidator(['Date']),
|
|
@@ -3371,6 +3415,7 @@ export var customEnduserFieldValidator = orValidator({
|
|
|
3371
3415
|
required: booleanValidatorOptional,
|
|
3372
3416
|
hiddenFromProfile: booleanValidatorOptional,
|
|
3373
3417
|
requireConfirmation: booleanValidatorOptional,
|
|
3418
|
+
tags: listOfStringsValidatorOptionalOrEmptyOk,
|
|
3374
3419
|
}),
|
|
3375
3420
|
"Auto Detect": objectValidator({
|
|
3376
3421
|
type: exactMatchValidator(["Auto Detect"]),
|
|
@@ -3379,6 +3424,7 @@ export var customEnduserFieldValidator = orValidator({
|
|
|
3379
3424
|
required: booleanValidatorOptional,
|
|
3380
3425
|
hiddenFromProfile: booleanValidatorOptional,
|
|
3381
3426
|
requireConfirmation: booleanValidatorOptional,
|
|
3427
|
+
tags: listOfStringsValidatorOptionalOrEmptyOk,
|
|
3382
3428
|
}),
|
|
3383
3429
|
"Table": objectValidator({
|
|
3384
3430
|
type: exactMatchValidator(["Table"]),
|
|
@@ -3389,6 +3435,7 @@ export var customEnduserFieldValidator = orValidator({
|
|
|
3389
3435
|
required: booleanValidatorOptional,
|
|
3390
3436
|
hiddenFromProfile: booleanValidatorOptional,
|
|
3391
3437
|
requireConfirmation: booleanValidatorOptional,
|
|
3438
|
+
tags: listOfStringsValidatorOptionalOrEmptyOk,
|
|
3392
3439
|
}),
|
|
3393
3440
|
"Checkbox": objectValidator({
|
|
3394
3441
|
type: exactMatchValidator(["Checkbox"]),
|
|
@@ -3397,6 +3444,7 @@ export var customEnduserFieldValidator = orValidator({
|
|
|
3397
3444
|
required: booleanValidatorOptional,
|
|
3398
3445
|
hiddenFromProfile: booleanValidatorOptional,
|
|
3399
3446
|
requireConfirmation: booleanValidatorOptional,
|
|
3447
|
+
tags: listOfStringsValidatorOptionalOrEmptyOk,
|
|
3400
3448
|
}),
|
|
3401
3449
|
"Database Select": objectValidator({
|
|
3402
3450
|
type: exactMatchValidator(["Database Select"]),
|
|
@@ -3408,6 +3456,7 @@ export var customEnduserFieldValidator = orValidator({
|
|
|
3408
3456
|
required: booleanValidatorOptional,
|
|
3409
3457
|
hiddenFromProfile: booleanValidatorOptional,
|
|
3410
3458
|
requireConfirmation: booleanValidatorOptional,
|
|
3459
|
+
tags: listOfStringsValidatorOptionalOrEmptyOk,
|
|
3411
3460
|
}),
|
|
3412
3461
|
});
|
|
3413
3462
|
export var customEnduserFieldsValidatorOptionalOrEmpty = listValidatorOptionalOrEmptyOk(customEnduserFieldValidator);
|
|
@@ -3666,6 +3715,7 @@ export var automationTriggerEventValidator = orValidator({
|
|
|
3666
3715
|
info: objectValidator({
|
|
3667
3716
|
titles: listOfStringsValidatorOptionalOrEmptyOk,
|
|
3668
3717
|
productIds: listOfMongoIdStringValidatorOptionalOrEmptyOk,
|
|
3718
|
+
titlePartialMatches: listOfStringsValidatorOptionalOrEmptyOk,
|
|
3669
3719
|
}),
|
|
3670
3720
|
conditions: optionalEmptyObjectValidator,
|
|
3671
3721
|
}),
|
|
@@ -3741,6 +3791,7 @@ export var automationTriggerEventValidator = orValidator({
|
|
|
3741
3791
|
type: exactMatchValidator(['Appointment Rescheduled']),
|
|
3742
3792
|
info: objectValidator({
|
|
3743
3793
|
titles: listOfStringsValidatorOptionalOrEmptyOk,
|
|
3794
|
+
detectManualReschedules: booleanValidatorOptional,
|
|
3744
3795
|
}),
|
|
3745
3796
|
conditions: optionalEmptyObjectValidator,
|
|
3746
3797
|
}),
|
|
@@ -4491,6 +4542,7 @@ export var analyticsQueryValidator = orValidator({
|
|
|
4491
4542
|
State: booleanValidatorOptional,
|
|
4492
4543
|
Phone: booleanValidatorOptional,
|
|
4493
4544
|
"Scheduled By": booleanValidatorOptional,
|
|
4545
|
+
"Completed By": booleanValidatorOptional,
|
|
4494
4546
|
alsoGroupByHost: booleanValidatorOptional,
|
|
4495
4547
|
"Cancel Reason": booleanValidatorOptional,
|
|
4496
4548
|
}, { isOptional: true, emptyOk: true }),
|
|
@@ -4829,6 +4881,54 @@ export var analyticsQueryValidator = orValidator({
|
|
|
4829
4881
|
key: exactMatchValidator(['Created At', 'Updated At']),
|
|
4830
4882
|
}, { isOptional: true, emptyOk: true })
|
|
4831
4883
|
}),
|
|
4884
|
+
"Chat Rooms": objectValidator({
|
|
4885
|
+
resource: exactMatchValidator(['Chat Rooms']),
|
|
4886
|
+
filter: objectValidator({}, { isOptional: true, emptyOk: true }),
|
|
4887
|
+
info: orValidator({
|
|
4888
|
+
"Total": objectValidator({
|
|
4889
|
+
method: exactMatchValidator(['Total']),
|
|
4890
|
+
parameters: optionalEmptyObjectValidator,
|
|
4891
|
+
}),
|
|
4892
|
+
}),
|
|
4893
|
+
grouping: objectValidator({
|
|
4894
|
+
Enduser: booleanValidatorOptional,
|
|
4895
|
+
Gender: booleanValidatorOptional,
|
|
4896
|
+
"Assigned To": booleanValidatorOptional,
|
|
4897
|
+
Field: stringValidatorOptionalEmptyOkay,
|
|
4898
|
+
Tags: booleanValidatorOptional,
|
|
4899
|
+
Age: booleanValidatorOptional,
|
|
4900
|
+
State: booleanValidatorOptional,
|
|
4901
|
+
Phone: booleanValidatorOptional,
|
|
4902
|
+
}, { isOptional: true, emptyOk: true }),
|
|
4903
|
+
range: objectValidator({
|
|
4904
|
+
interval: exactMatchValidator(['Daily', 'Weekly', 'Monthly', 'Hourly']),
|
|
4905
|
+
key: exactMatchValidator(['Created At', 'Updated At']),
|
|
4906
|
+
}, { isOptional: true, emptyOk: true })
|
|
4907
|
+
}),
|
|
4908
|
+
"Chats": objectValidator({
|
|
4909
|
+
resource: exactMatchValidator(['Chats']),
|
|
4910
|
+
filter: objectValidator({}, { isOptional: true, emptyOk: true }),
|
|
4911
|
+
info: orValidator({
|
|
4912
|
+
"Total": objectValidator({
|
|
4913
|
+
method: exactMatchValidator(['Total']),
|
|
4914
|
+
parameters: optionalEmptyObjectValidator,
|
|
4915
|
+
}),
|
|
4916
|
+
}),
|
|
4917
|
+
grouping: objectValidator({
|
|
4918
|
+
Enduser: booleanValidatorOptional,
|
|
4919
|
+
Gender: booleanValidatorOptional,
|
|
4920
|
+
"Assigned To": booleanValidatorOptional,
|
|
4921
|
+
Field: stringValidatorOptionalEmptyOkay,
|
|
4922
|
+
Tags: booleanValidatorOptional,
|
|
4923
|
+
Age: booleanValidatorOptional,
|
|
4924
|
+
State: booleanValidatorOptional,
|
|
4925
|
+
Phone: booleanValidatorOptional,
|
|
4926
|
+
}, { isOptional: true, emptyOk: true }),
|
|
4927
|
+
range: objectValidator({
|
|
4928
|
+
interval: exactMatchValidator(['Daily', 'Weekly', 'Monthly', 'Hourly']),
|
|
4929
|
+
key: exactMatchValidator(['Created At', 'Updated At']),
|
|
4930
|
+
}, { isOptional: true, emptyOk: true })
|
|
4931
|
+
}),
|
|
4832
4932
|
});
|
|
4833
4933
|
export var analyticsQueriesValidatorOptional = listValidatorOptionalOrEmptyOk(analyticsQueryValidator);
|
|
4834
4934
|
var _ANALYTICS_FRAME_TYPES = {
|
|
@@ -4851,6 +4951,8 @@ var _ANALYTICS_QUERY_TYPES = {
|
|
|
4851
4951
|
Meetings: true,
|
|
4852
4952
|
"Journey Logs": true,
|
|
4853
4953
|
Orders: true,
|
|
4954
|
+
"Chat Rooms": true,
|
|
4955
|
+
"Chats": true,
|
|
4854
4956
|
};
|
|
4855
4957
|
export var ANALYTICS_QUERY_TYPES = Object.keys(_ANALYTICS_QUERY_TYPES);
|
|
4856
4958
|
export var analyticsQueryTypeValidator = exactMatchValidator(ANALYTICS_QUERY_TYPES);
|
|
@@ -4882,6 +4984,7 @@ export var userUIRestrictionsValidator = objectValidator({
|
|
|
4882
4984
|
hideMergeEndusers: booleanValidatorOptional,
|
|
4883
4985
|
hideQueuedTicketsViewer: booleanValidatorOptional,
|
|
4884
4986
|
hideIncomingFaxesIcon: booleanValidatorOptional,
|
|
4987
|
+
hideNotificationsIcon: booleanValidatorOptional,
|
|
4885
4988
|
hideBulkEnduserActions: booleanValidatorOptional,
|
|
4886
4989
|
visibleIntegrations: listOfStringsValidatorUniqueOptionalOrEmptyOkay,
|
|
4887
4990
|
}, { emptyOk: true });
|