@tellescope/validation 1.226.0 → 1.228.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 +51 -1
- package/lib/cjs/validation.d.ts.map +1 -1
- package/lib/cjs/validation.js +86 -8
- package/lib/cjs/validation.js.map +1 -1
- package/lib/esm/validation.d.ts +51 -1
- package/lib/esm/validation.d.ts.map +1 -1
- package/lib/esm/validation.js +82 -4
- package/lib/esm/validation.js.map +1 -1
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/package.json +7 -7
- package/src/validation.ts +89 -10
package/src/validation.ts
CHANGED
|
@@ -120,6 +120,7 @@ import {
|
|
|
120
120
|
EnduserFormResponseForEvent,
|
|
121
121
|
StateCredentialInfo,
|
|
122
122
|
BaseAvailabilityBlock,
|
|
123
|
+
CalendarEventLimit,
|
|
123
124
|
WeeklyAvailability,
|
|
124
125
|
MonthlyRestriction,
|
|
125
126
|
Timezone,
|
|
@@ -268,6 +269,8 @@ import {
|
|
|
268
269
|
SmartMeterPlaceOrderAutomationAction,
|
|
269
270
|
SmartMeterOrderLineItem,
|
|
270
271
|
FormFieldFeedback,
|
|
272
|
+
FormFieldOptionDetails,
|
|
273
|
+
MultipleChoiceOptions,
|
|
271
274
|
CandidProcedureCode,
|
|
272
275
|
BasicWebhook,
|
|
273
276
|
RemoveEnduserTagsAutomationAction,
|
|
@@ -1547,11 +1550,6 @@ export const labeledFieldsValidator = listValidatorOptionalOrEmptyOk(objectValid
|
|
|
1547
1550
|
value: stringValidator5000,
|
|
1548
1551
|
}))
|
|
1549
1552
|
|
|
1550
|
-
type MultipleChoiceOptions = {
|
|
1551
|
-
choices: string[],
|
|
1552
|
-
other: boolean,
|
|
1553
|
-
radio: boolean,
|
|
1554
|
-
}
|
|
1555
1553
|
|
|
1556
1554
|
const DEFAULT_ENDUSER_FIELDS = [
|
|
1557
1555
|
'_id', 'email', 'phone', 'fname', 'lname', 'journeys', 'tags', 'preference'
|
|
@@ -1671,11 +1669,12 @@ export const FORM_FIELD_VALIDATORS_BY_TYPE: { [K in FormFieldType | 'userEmail'
|
|
|
1671
1669
|
}
|
|
1672
1670
|
|
|
1673
1671
|
const parsed = []
|
|
1672
|
+
const choices = fieldOptions.choices || []
|
|
1674
1673
|
for (const i of indexes) {
|
|
1675
1674
|
if (typeof i !== 'number') throw new Error(`Choice ${i} is not a valid index`)
|
|
1676
|
-
if (i < 0 || i >=
|
|
1675
|
+
if (i < 0 || i >= choices.length) throw new Error(`Choice ${i} is not a valid index`)
|
|
1677
1676
|
|
|
1678
|
-
parsed.push(
|
|
1677
|
+
parsed.push(choices[i])
|
|
1679
1678
|
}
|
|
1680
1679
|
if (otherText && fieldOptions.other === true) parsed.push(otherText)
|
|
1681
1680
|
// todo: add length limit to otherText?
|
|
@@ -2994,12 +2993,16 @@ export const automationActionValidator = orValidator<{ [K in AutomationActionTyp
|
|
|
2994
2993
|
setEnduserFields: objectValidator<SetEnduserFieldsAutomationAction>({
|
|
2995
2994
|
...sharedAutomationActionValidators,
|
|
2996
2995
|
type: exactMatchValidator(['setEnduserFields']),
|
|
2997
|
-
info: objectValidator<SetEnduserFieldsAutomationAction['info']>({
|
|
2996
|
+
info: objectValidator<SetEnduserFieldsAutomationAction['info']>({
|
|
2998
2997
|
fields: listValidator(objectValidator<EnduserFieldSetter>({
|
|
2999
2998
|
name: stringValidator,
|
|
3000
2999
|
type: stringValidator,
|
|
3001
|
-
value:
|
|
3000
|
+
value: stringValidatorOptionalEmptyOkay,
|
|
3002
3001
|
increment: numberValidatorOptional,
|
|
3002
|
+
dateDifferenceOptions: objectValidator({
|
|
3003
|
+
date1: stringValidator,
|
|
3004
|
+
date2: stringValidator,
|
|
3005
|
+
}, { isOptional: true }),
|
|
3003
3006
|
}))
|
|
3004
3007
|
}, { emptyOk: false }),
|
|
3005
3008
|
}),
|
|
@@ -3430,6 +3433,7 @@ export const portalSettingsValidator = objectValidator<PortalSettings>({
|
|
|
3430
3433
|
loginDescription: stringValidator1000Optional,
|
|
3431
3434
|
loginGraphic: stringValidator1000Optional,
|
|
3432
3435
|
loginTitle: stringValidator1000Optional,
|
|
3436
|
+
loginBottomHTML: stringValidator5000OptionalEmptyOkay,
|
|
3433
3437
|
registerDescription: stringValidator1000Optional,
|
|
3434
3438
|
registerGraphic: stringValidator1000Optional,
|
|
3435
3439
|
registerTitle: stringValidator1000Optional,
|
|
@@ -3453,6 +3457,7 @@ export const portalSettingsValidator = objectValidator<PortalSettings>({
|
|
|
3453
3457
|
availableFormsTitle: stringValidatorOptionalEmptyOkay,
|
|
3454
3458
|
outstandingFormsTitle: stringValidatorOptionalEmptyOkay,
|
|
3455
3459
|
}, { isOptional: true, emptyOk: true }),
|
|
3460
|
+
hideSettingsPage: booleanValidatorOptional,
|
|
3456
3461
|
})
|
|
3457
3462
|
|
|
3458
3463
|
export const customPoliciesValidator = listValidatorOptionalOrEmptyOk(objectValidator<{ title: string, url: string }>({
|
|
@@ -3588,12 +3593,17 @@ export const formFieldFeedbackValidator = objectValidator<FormFieldFeedback>({
|
|
|
3588
3593
|
ifEquals: stringValidator,
|
|
3589
3594
|
display: stringValidator,
|
|
3590
3595
|
})
|
|
3596
|
+
export const formFieldOptionDetailsValidator = objectValidator<FormFieldOptionDetails>({
|
|
3597
|
+
option: stringValidator,
|
|
3598
|
+
description: stringValidator5000Optional,
|
|
3599
|
+
})
|
|
3591
3600
|
|
|
3592
3601
|
export const formFieldOptionsValidator = objectValidator<FormFieldOptions>({
|
|
3593
3602
|
default: stringValidatorOptional,
|
|
3594
3603
|
bookingPageId: stringValidatorOptional,
|
|
3595
3604
|
tableChoices: listValidatorOptionalOrEmptyOk(tableInputChoiceValidator),
|
|
3596
3605
|
choices: listOfStringsValidatorOptionalOrEmptyOk,
|
|
3606
|
+
optionDetails: listValidatorOptionalOrEmptyOk(formFieldOptionDetailsValidator),
|
|
3597
3607
|
radioChoices: listOfStringsValidatorOptionalOrEmptyOk,
|
|
3598
3608
|
canvasCodings: listValidatorOptionalOrEmptyOk(canvasCodingValidator),
|
|
3599
3609
|
from: numberValidatorOptional,
|
|
@@ -3616,6 +3626,7 @@ export const formFieldOptionsValidator = objectValidator<FormFieldOptions>({
|
|
|
3616
3626
|
databaseId: mongoIdStringOptional,
|
|
3617
3627
|
databaseLabel: stringValidatorOptionalEmptyOkay,
|
|
3618
3628
|
databaseLabels: listOfStringsValidatorOptionalOrEmptyOk,
|
|
3629
|
+
filterByEnduserState: booleanValidatorOptional,
|
|
3619
3630
|
databaseFilter: objectValidator<FormFieldOptions['databaseFilter']>({
|
|
3620
3631
|
databaseLabel: stringValidator1000Optional,
|
|
3621
3632
|
fieldId: mongoIdStringOptional,
|
|
@@ -3663,6 +3674,7 @@ export const formFieldOptionsValidator = objectValidator<FormFieldOptions>({
|
|
|
3663
3674
|
max: numberValidatorOptional,
|
|
3664
3675
|
min: numberValidatorOptional,
|
|
3665
3676
|
stripeKey: stringValidatorOptionalEmptyOkay,
|
|
3677
|
+
stripeProductSelectionMode: booleanValidatorOptional,
|
|
3666
3678
|
dataSource: stringValidatorOptionalEmptyOkay,
|
|
3667
3679
|
esignatureTermsCompanyName: stringValidatorOptionalEmptyOkay,
|
|
3668
3680
|
observationCode: stringValidatorOptionalEmptyOkay,
|
|
@@ -4041,6 +4053,7 @@ export const portalBlockValidator = orValidator<{ [K in PortalBlockType]: Portal
|
|
|
4041
4053
|
title: stringValidator,
|
|
4042
4054
|
roles: listOfStringsValidatorOptionalOrEmptyOk,
|
|
4043
4055
|
showAll: booleanValidatorOptional,
|
|
4056
|
+
hideContactButton: booleanValidatorOptional,
|
|
4044
4057
|
// members: listValidatorEmptyOk(
|
|
4045
4058
|
// objectValidator<CareTeamMemberPortalCustomizationInfo>({
|
|
4046
4059
|
// title: stringValidator(),
|
|
@@ -4129,6 +4142,7 @@ export const baseAvailabilityBlockValidator = objectValidator<BaseAvailabilityBl
|
|
|
4129
4142
|
startTimeInMS: nonNegNumberValidator,
|
|
4130
4143
|
userId: mongoIdStringRequired,
|
|
4131
4144
|
externalId: stringValidatorOptionalEmptyOkay,
|
|
4145
|
+
priority: numberValidatorOptional,
|
|
4132
4146
|
})
|
|
4133
4147
|
export const baseAvailabilityBlocksValidator = listValidatorEmptyOk(baseAvailabilityBlockValidator)
|
|
4134
4148
|
|
|
@@ -4168,6 +4182,13 @@ export const weeklyAvailabilityValidator = objectValidator<WeeklyAvailability>({
|
|
|
4168
4182
|
})
|
|
4169
4183
|
export const weeklyAvailabilitiesValidator = listValidatorEmptyOk(weeklyAvailabilityValidator)
|
|
4170
4184
|
|
|
4185
|
+
export const calendarEventLimitValidator = objectValidator<CalendarEventLimit>({
|
|
4186
|
+
templateId: mongoIdStringRequired,
|
|
4187
|
+
period: nonNegNumberValidator,
|
|
4188
|
+
limit: nonNegNumberValidator,
|
|
4189
|
+
})
|
|
4190
|
+
export const calendarEventLimitsValidator = listValidatorEmptyOk(calendarEventLimitValidator)
|
|
4191
|
+
|
|
4171
4192
|
export const timezoneValidator = exactMatchValidator<Timezone>(Object.keys(TIMEZONE_MAP) as Timezone[])
|
|
4172
4193
|
export const timezoneValidatorOptional = exactMatchValidator<Timezone>(Object.keys(TIMEZONE_MAP) as Timezone[], { isOptional: true })
|
|
4173
4194
|
|
|
@@ -4581,6 +4602,7 @@ export const automationTriggerEventValidator = orValidator<{ [K in AutomationTri
|
|
|
4581
4602
|
info: objectValidator<AutomationTriggerEvents['Purchase Made']['info']>({
|
|
4582
4603
|
titles: listOfStringsValidatorOptionalOrEmptyOk,
|
|
4583
4604
|
productIds: listOfMongoIdStringValidatorOptionalOrEmptyOk,
|
|
4605
|
+
titlePartialMatches: listOfStringsValidatorOptionalOrEmptyOk,
|
|
4584
4606
|
}),
|
|
4585
4607
|
conditions: optionalEmptyObjectValidator,
|
|
4586
4608
|
}),
|
|
@@ -4906,8 +4928,12 @@ export const automationTriggerActionValidator = orValidator<{ [K in AutomationTr
|
|
|
4906
4928
|
fields: listValidator(objectValidator<EnduserFieldSetter>({
|
|
4907
4929
|
name: stringValidator,
|
|
4908
4930
|
type: stringValidator,
|
|
4909
|
-
value:
|
|
4931
|
+
value: stringValidatorOptionalEmptyOkay,
|
|
4910
4932
|
increment: numberValidatorOptional,
|
|
4933
|
+
dateDifferenceOptions: objectValidator({
|
|
4934
|
+
date1: stringValidator,
|
|
4935
|
+
date2: stringValidator,
|
|
4936
|
+
}, { isOptional: true }),
|
|
4911
4937
|
}))
|
|
4912
4938
|
}),
|
|
4913
4939
|
}),
|
|
@@ -5799,6 +5825,56 @@ export const analyticsQueryValidator = orValidator<{ [K in AnalyticsQueryType]:
|
|
|
5799
5825
|
key: exactMatchValidator<AnalyticsQueryRangeKeyForType['Orders']>(['Created At', 'Updated At']),
|
|
5800
5826
|
}, { isOptional: true, emptyOk: true })
|
|
5801
5827
|
}),
|
|
5828
|
+
"Chat Rooms": objectValidator<AnalyticsQueryForType['Chat Rooms']>({
|
|
5829
|
+
resource: exactMatchValidator<'Chat Rooms'>(['Chat Rooms']),
|
|
5830
|
+
filter: objectValidator<AnalyticsQueryFilterForType['Chat Rooms']>({
|
|
5831
|
+
}, { isOptional: true, emptyOk: true }),
|
|
5832
|
+
info: orValidator<{ [K in keyof AnalyticsQueryInfoForType['Chat Rooms']]: AnalyticsQueryInfoForType['Chat Rooms'][K] }>({
|
|
5833
|
+
"Total": objectValidator<AnalyticsQueryInfoForType['Chat Rooms']['Total']>({
|
|
5834
|
+
method: exactMatchValidator<"Total">(['Total']),
|
|
5835
|
+
parameters: optionalEmptyObjectValidator,
|
|
5836
|
+
}),
|
|
5837
|
+
}),
|
|
5838
|
+
grouping: objectValidator<AnalyticsQueryGroupingForType['Chat Rooms']>({
|
|
5839
|
+
Enduser: booleanValidatorOptional,
|
|
5840
|
+
Gender: booleanValidatorOptional,
|
|
5841
|
+
"Assigned To": booleanValidatorOptional,
|
|
5842
|
+
Field: stringValidatorOptionalEmptyOkay,
|
|
5843
|
+
Tags: booleanValidatorOptional,
|
|
5844
|
+
Age: booleanValidatorOptional,
|
|
5845
|
+
State: booleanValidatorOptional,
|
|
5846
|
+
Phone: booleanValidatorOptional,
|
|
5847
|
+
}, { isOptional: true, emptyOk: true }),
|
|
5848
|
+
range: objectValidator<AnalyticsQueryRange<any>>({
|
|
5849
|
+
interval: exactMatchValidator<AnalyticsQueryRangeInterval>(['Daily', 'Weekly', 'Monthly', 'Hourly']),
|
|
5850
|
+
key: exactMatchValidator<AnalyticsQueryRangeKeyForType['Chat Rooms']>(['Created At', 'Updated At']),
|
|
5851
|
+
}, { isOptional: true, emptyOk: true })
|
|
5852
|
+
}),
|
|
5853
|
+
"Chats": objectValidator<AnalyticsQueryForType['Chats']>({
|
|
5854
|
+
resource: exactMatchValidator<'Chats'>(['Chats']),
|
|
5855
|
+
filter: objectValidator<AnalyticsQueryFilterForType['Chats']>({
|
|
5856
|
+
}, { isOptional: true, emptyOk: true }),
|
|
5857
|
+
info: orValidator<{ [K in keyof AnalyticsQueryInfoForType['Chats']]: AnalyticsQueryInfoForType['Chats'][K] }>({
|
|
5858
|
+
"Total": objectValidator<AnalyticsQueryInfoForType['Chats']['Total']>({
|
|
5859
|
+
method: exactMatchValidator<"Total">(['Total']),
|
|
5860
|
+
parameters: optionalEmptyObjectValidator,
|
|
5861
|
+
}),
|
|
5862
|
+
}),
|
|
5863
|
+
grouping: objectValidator<AnalyticsQueryGroupingForType['Chats']>({
|
|
5864
|
+
Enduser: booleanValidatorOptional,
|
|
5865
|
+
Gender: booleanValidatorOptional,
|
|
5866
|
+
"Assigned To": booleanValidatorOptional,
|
|
5867
|
+
Field: stringValidatorOptionalEmptyOkay,
|
|
5868
|
+
Tags: booleanValidatorOptional,
|
|
5869
|
+
Age: booleanValidatorOptional,
|
|
5870
|
+
State: booleanValidatorOptional,
|
|
5871
|
+
Phone: booleanValidatorOptional,
|
|
5872
|
+
}, { isOptional: true, emptyOk: true }),
|
|
5873
|
+
range: objectValidator<AnalyticsQueryRange<any>>({
|
|
5874
|
+
interval: exactMatchValidator<AnalyticsQueryRangeInterval>(['Daily', 'Weekly', 'Monthly', 'Hourly']),
|
|
5875
|
+
key: exactMatchValidator<AnalyticsQueryRangeKeyForType['Chats']>(['Created At', 'Updated At']),
|
|
5876
|
+
}, { isOptional: true, emptyOk: true })
|
|
5877
|
+
}),
|
|
5802
5878
|
})
|
|
5803
5879
|
export const analyticsQueriesValidatorOptional = listValidatorOptionalOrEmptyOk(analyticsQueryValidator)
|
|
5804
5880
|
|
|
@@ -5823,6 +5899,8 @@ const _ANALYTICS_QUERY_TYPES: { [K in AnalyticsQueryType]: any } = {
|
|
|
5823
5899
|
Meetings: true,
|
|
5824
5900
|
"Journey Logs": true,
|
|
5825
5901
|
Orders: true,
|
|
5902
|
+
"Chat Rooms": true,
|
|
5903
|
+
"Chats": true,
|
|
5826
5904
|
}
|
|
5827
5905
|
export const ANALYTICS_QUERY_TYPES = Object.keys(_ANALYTICS_QUERY_TYPES) as AnalyticsQueryType[]
|
|
5828
5906
|
export const analyticsQueryTypeValidator = exactMatchValidator<AnalyticsQueryType>(ANALYTICS_QUERY_TYPES)
|
|
@@ -5856,6 +5934,7 @@ export const userUIRestrictionsValidator = objectValidator<UserUIRestrictions>({
|
|
|
5856
5934
|
hideMergeEndusers: booleanValidatorOptional,
|
|
5857
5935
|
hideQueuedTicketsViewer: booleanValidatorOptional,
|
|
5858
5936
|
hideIncomingFaxesIcon: booleanValidatorOptional,
|
|
5937
|
+
hideNotificationsIcon: booleanValidatorOptional,
|
|
5859
5938
|
hideBulkEnduserActions: booleanValidatorOptional,
|
|
5860
5939
|
visibleIntegrations: listOfStringsValidatorUniqueOptionalOrEmptyOkay,
|
|
5861
5940
|
}, { emptyOk: true })
|