@tellescope/validation 1.74.0 → 1.74.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/lib/cjs/validation.d.ts +83 -4
- package/lib/cjs/validation.d.ts.map +1 -1
- package/lib/cjs/validation.js +66 -7
- package/lib/cjs/validation.js.map +1 -1
- package/lib/esm/validation.d.ts +83 -4
- package/lib/esm/validation.d.ts.map +1 -1
- package/lib/esm/validation.js +62 -3
- package/lib/esm/validation.js.map +1 -1
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/package.json +6 -6
- package/src/validation.ts +68 -4
package/src/validation.ts
CHANGED
|
@@ -1035,8 +1035,8 @@ export const nameValidator: ValidatorDefinition<string> = {
|
|
|
1035
1035
|
name => {
|
|
1036
1036
|
if (typeof name !== 'string') throw new Error('Expecting string value')
|
|
1037
1037
|
|
|
1038
|
-
//
|
|
1039
|
-
name = name.substring(0, 100) // escape_name(name)
|
|
1038
|
+
// need to explicitly trim here, trim: true not currently working (mar 7, 2024)
|
|
1039
|
+
name = name.trim().substring(0, 100) // escape_name(name)
|
|
1040
1040
|
if (!name) throw new Error("Invalid name")
|
|
1041
1041
|
|
|
1042
1042
|
return first_letter_capitalized(name)
|
|
@@ -2112,6 +2112,11 @@ export const listOfStringsWithQualifierValidatorOptional = objectValidator<ListO
|
|
|
2112
2112
|
values: listOfStringsValidator,
|
|
2113
2113
|
}, { isOptional: true })
|
|
2114
2114
|
|
|
2115
|
+
export const listOfStringsWithQualifierValidatorOptionalValuesEmptyOkay = objectValidator<ListOfStringsWithQualifier>({
|
|
2116
|
+
qualifier: listQueryQualifiersValidator,
|
|
2117
|
+
values: listOfStringsValidatorEmptyOk,
|
|
2118
|
+
}, { isOptional: true })
|
|
2119
|
+
|
|
2115
2120
|
const _AUTOMATION_ENDUSER_STATUS: { [K in AutomatedActionStatus]: any } = {
|
|
2116
2121
|
active: '',
|
|
2117
2122
|
finished: '',
|
|
@@ -2191,6 +2196,13 @@ export const calendarEventReminderValidator = orValidator<{ [K in CalendarEventR
|
|
|
2191
2196
|
type: exactMatchValidator<'add-to-journey'>(['add-to-journey']),
|
|
2192
2197
|
...sharedReminderValidators,
|
|
2193
2198
|
}),
|
|
2199
|
+
'Remove From Journey': objectValidator<CalendarEventReminderInfoForType['Remove From Journey']>({
|
|
2200
|
+
info: objectValidator<CalendarEventReminderInfoForType['Remove From Journey']['info']>({
|
|
2201
|
+
journeyId: mongoIdStringRequired,
|
|
2202
|
+
}),
|
|
2203
|
+
type: exactMatchValidator<'Remove From Journey'>(['Remove From Journey']),
|
|
2204
|
+
...sharedReminderValidators,
|
|
2205
|
+
}),
|
|
2194
2206
|
"enduser-notification": objectValidator<CalendarEventReminderInfoForType['enduser-notification']>({
|
|
2195
2207
|
info: objectValidator<CalendarEventReminderNotificationInfo>({
|
|
2196
2208
|
templateId: mongoIdStringOptional,
|
|
@@ -2836,6 +2848,8 @@ const _DATABASE_RECORD_FIELD_TYPES: { [K in DatabaseRecordFieldType]: any } = {
|
|
|
2836
2848
|
Number: '',
|
|
2837
2849
|
Address: '',
|
|
2838
2850
|
'Multiple Select': '',
|
|
2851
|
+
Email: '',
|
|
2852
|
+
Phone: '',
|
|
2839
2853
|
}
|
|
2840
2854
|
export const DATABASE_RECORD_FIELD_TYPES = Object.keys(_DATABASE_RECORD_FIELD_TYPES) as DatabaseRecordFieldType[]
|
|
2841
2855
|
export const databaseRecordFieldTypeValidator = exactMatchValidator<DatabaseRecordFieldType>(DATABASE_RECORD_FIELD_TYPES)
|
|
@@ -2846,14 +2860,34 @@ export const databaseFieldValidator = orValidator<{ [K in DatabaseRecordFieldTyp
|
|
|
2846
2860
|
type: exactMatchValidator(['Text']),
|
|
2847
2861
|
label: stringValidator250,
|
|
2848
2862
|
hideFromTable: booleanValidatorOptional,
|
|
2863
|
+
required: booleanValidatorOptional,
|
|
2849
2864
|
options: objectValidator<DatabaseRecordFields['Text']['options']>({
|
|
2850
2865
|
width: stringValidatorOptionalEmptyOkay,
|
|
2851
2866
|
}, { isOptional: true, emptyOk: true }),
|
|
2852
2867
|
}),
|
|
2868
|
+
Email: objectValidator<DatabaseRecordFields['Email']>({
|
|
2869
|
+
type: exactMatchValidator(['Email']),
|
|
2870
|
+
label: stringValidator250,
|
|
2871
|
+
hideFromTable: booleanValidatorOptional,
|
|
2872
|
+
required: booleanValidatorOptional,
|
|
2873
|
+
options: objectValidator<DatabaseRecordFields['Email']['options']>({
|
|
2874
|
+
width: stringValidatorOptionalEmptyOkay,
|
|
2875
|
+
}, { isOptional: true, emptyOk: true }),
|
|
2876
|
+
}),
|
|
2877
|
+
Phone: objectValidator<DatabaseRecordFields['Phone']>({
|
|
2878
|
+
type: exactMatchValidator(['Phone']),
|
|
2879
|
+
label: stringValidator250,
|
|
2880
|
+
hideFromTable: booleanValidatorOptional,
|
|
2881
|
+
required: booleanValidatorOptional,
|
|
2882
|
+
options: objectValidator<DatabaseRecordFields['Phone']['options']>({
|
|
2883
|
+
width: stringValidatorOptionalEmptyOkay,
|
|
2884
|
+
}, { isOptional: true, emptyOk: true }),
|
|
2885
|
+
}),
|
|
2853
2886
|
'Text Long': objectValidator<DatabaseRecordFields['Text Long']>({
|
|
2854
2887
|
type: exactMatchValidator(['Text Long']),
|
|
2855
2888
|
label: stringValidator250,
|
|
2856
2889
|
hideFromTable: booleanValidatorOptional,
|
|
2890
|
+
required: booleanValidatorOptional,
|
|
2857
2891
|
options: objectValidator<DatabaseRecordFields['Text Long']['options']>({
|
|
2858
2892
|
width: stringValidatorOptionalEmptyOkay,
|
|
2859
2893
|
}, { isOptional: true, emptyOk: true }),
|
|
@@ -2862,6 +2896,7 @@ export const databaseFieldValidator = orValidator<{ [K in DatabaseRecordFieldTyp
|
|
|
2862
2896
|
type: exactMatchValidator(['Text List']),
|
|
2863
2897
|
label: stringValidator250,
|
|
2864
2898
|
hideFromTable: booleanValidatorOptional,
|
|
2899
|
+
required: booleanValidatorOptional,
|
|
2865
2900
|
options: objectValidator<DatabaseRecordFields['Text List']['options']>({
|
|
2866
2901
|
width: stringValidatorOptionalEmptyOkay,
|
|
2867
2902
|
}, { isOptional: true, emptyOk: true }),
|
|
@@ -2870,6 +2905,7 @@ export const databaseFieldValidator = orValidator<{ [K in DatabaseRecordFieldTyp
|
|
|
2870
2905
|
type: exactMatchValidator(['Number']),
|
|
2871
2906
|
label: stringValidator250,
|
|
2872
2907
|
hideFromTable: booleanValidatorOptional,
|
|
2908
|
+
required: booleanValidatorOptional,
|
|
2873
2909
|
options: objectValidator<DatabaseRecordFields['Number']['options']>({
|
|
2874
2910
|
width: stringValidatorOptionalEmptyOkay,
|
|
2875
2911
|
}, { isOptional: true, emptyOk: true }),
|
|
@@ -2878,6 +2914,7 @@ export const databaseFieldValidator = orValidator<{ [K in DatabaseRecordFieldTyp
|
|
|
2878
2914
|
type: exactMatchValidator(['Address']),
|
|
2879
2915
|
label: stringValidator250,
|
|
2880
2916
|
hideFromTable: booleanValidatorOptional,
|
|
2917
|
+
required: booleanValidatorOptional,
|
|
2881
2918
|
options: objectValidator<DatabaseRecordFields['Address']['options']>({
|
|
2882
2919
|
width: stringValidatorOptionalEmptyOkay,
|
|
2883
2920
|
}, { isOptional: true, emptyOk: true }),
|
|
@@ -2886,6 +2923,7 @@ export const databaseFieldValidator = orValidator<{ [K in DatabaseRecordFieldTyp
|
|
|
2886
2923
|
type: exactMatchValidator(['Multiple Select']),
|
|
2887
2924
|
label: stringValidator250,
|
|
2888
2925
|
hideFromTable: booleanValidatorOptional,
|
|
2926
|
+
required: booleanValidatorOptional,
|
|
2889
2927
|
options: objectValidator<DatabaseRecordFields['Multiple Select']['options']>({
|
|
2890
2928
|
width: stringValidatorOptionalEmptyOkay,
|
|
2891
2929
|
options: listOfStringsValidatorEmptyOk,
|
|
@@ -2901,6 +2939,16 @@ export const databaseRecordValueValidator = orValidator<{ [K in DatabaseRecordFi
|
|
|
2901
2939
|
value: stringValidator5000OptionalEmptyOkay,
|
|
2902
2940
|
label: stringValidator250,
|
|
2903
2941
|
}),
|
|
2942
|
+
Phone: objectValidator<DatabaseRecordValues['Phone']>({
|
|
2943
|
+
type: exactMatchValidator(['Phone']),
|
|
2944
|
+
value: phoneValidatorOptional,
|
|
2945
|
+
label: stringValidator250,
|
|
2946
|
+
}),
|
|
2947
|
+
Email: objectValidator<DatabaseRecordValues['Email']>({
|
|
2948
|
+
type: exactMatchValidator(['Email']),
|
|
2949
|
+
value: emailValidatorOptional,
|
|
2950
|
+
label: stringValidator250,
|
|
2951
|
+
}),
|
|
2904
2952
|
'Text Long': objectValidator<DatabaseRecordValues['Text Long']>({
|
|
2905
2953
|
type: exactMatchValidator(['Text Long']),
|
|
2906
2954
|
value: stringValidator5000OptionalEmptyOkay,
|
|
@@ -3745,6 +3793,7 @@ export const analyticsQueryValidator = orValidator<{ [K in AnalyticsQueryType]:
|
|
|
3745
3793
|
Field: stringValidatorOptionalEmptyOkay,
|
|
3746
3794
|
Tags: booleanValidatorOptional,
|
|
3747
3795
|
Age: booleanValidatorOptional,
|
|
3796
|
+
State: booleanValidatorOptional,
|
|
3748
3797
|
}, { isOptional: true, emptyOk: true }),
|
|
3749
3798
|
range: objectValidator<AnalyticsQueryRange<any>>({
|
|
3750
3799
|
interval: exactMatchValidator<AnalyticsQueryRangeInterval>(['Daily', 'Weekly', 'Monthly']),
|
|
@@ -3770,6 +3819,13 @@ export const analyticsQueryValidator = orValidator<{ [K in AnalyticsQueryType]:
|
|
|
3770
3819
|
}),
|
|
3771
3820
|
grouping: objectValidator<AnalyticsQueryGroupingForType['Calendar Events']>({
|
|
3772
3821
|
Type: booleanValidatorOptional,
|
|
3822
|
+
Enduser: booleanValidatorOptional,
|
|
3823
|
+
Gender: booleanValidatorOptional,
|
|
3824
|
+
"Assigned To": booleanValidatorOptional,
|
|
3825
|
+
Field: stringValidatorOptionalEmptyOkay,
|
|
3826
|
+
Tags: booleanValidatorOptional,
|
|
3827
|
+
Age: booleanValidatorOptional,
|
|
3828
|
+
State: booleanValidatorOptional,
|
|
3773
3829
|
}, { isOptional: true, emptyOk: true }),
|
|
3774
3830
|
range: objectValidator<AnalyticsQueryRange<any>>({
|
|
3775
3831
|
interval: exactMatchValidator<AnalyticsQueryRangeInterval>(['Daily', 'Weekly', 'Monthly']),
|
|
@@ -3799,6 +3855,7 @@ export const analyticsQueryValidator = orValidator<{ [K in AnalyticsQueryType]:
|
|
|
3799
3855
|
Field: stringValidatorOptionalEmptyOkay,
|
|
3800
3856
|
Tags: booleanValidatorOptional,
|
|
3801
3857
|
Age: booleanValidatorOptional,
|
|
3858
|
+
State: booleanValidatorOptional,
|
|
3802
3859
|
}, { isOptional: true, emptyOk: true }),
|
|
3803
3860
|
range: objectValidator<AnalyticsQueryRange<any>>({
|
|
3804
3861
|
interval: exactMatchValidator<AnalyticsQueryRangeInterval>(['Daily', 'Weekly', 'Monthly']),
|
|
@@ -3822,6 +3879,7 @@ export const analyticsQueryValidator = orValidator<{ [K in AnalyticsQueryType]:
|
|
|
3822
3879
|
Field: stringValidatorOptionalEmptyOkay,
|
|
3823
3880
|
Tags: booleanValidatorOptional,
|
|
3824
3881
|
Age: booleanValidatorOptional,
|
|
3882
|
+
State: booleanValidatorOptional,
|
|
3825
3883
|
}, { isOptional: true, emptyOk: true }),
|
|
3826
3884
|
range: objectValidator<AnalyticsQueryRange<any>>({
|
|
3827
3885
|
interval: exactMatchValidator<AnalyticsQueryRangeInterval>(['Daily', 'Weekly', 'Monthly']),
|
|
@@ -3844,6 +3902,7 @@ export const analyticsQueryValidator = orValidator<{ [K in AnalyticsQueryType]:
|
|
|
3844
3902
|
Field: stringValidatorOptionalEmptyOkay,
|
|
3845
3903
|
Tags: booleanValidatorOptional,
|
|
3846
3904
|
Age: booleanValidatorOptional,
|
|
3905
|
+
State: booleanValidatorOptional,
|
|
3847
3906
|
}, { isOptional: true, emptyOk: true }),
|
|
3848
3907
|
range: objectValidator<AnalyticsQueryRange<any>>({
|
|
3849
3908
|
interval: exactMatchValidator<AnalyticsQueryRangeInterval>(['Daily', 'Weekly', 'Monthly']),
|
|
@@ -3866,6 +3925,7 @@ export const analyticsQueryValidator = orValidator<{ [K in AnalyticsQueryType]:
|
|
|
3866
3925
|
Field: stringValidatorOptionalEmptyOkay,
|
|
3867
3926
|
Tags: booleanValidatorOptional,
|
|
3868
3927
|
Age: booleanValidatorOptional,
|
|
3928
|
+
State: booleanValidatorOptional,
|
|
3869
3929
|
}, { isOptional: true, emptyOk: true }),
|
|
3870
3930
|
range: objectValidator<AnalyticsQueryRange<any>>({
|
|
3871
3931
|
interval: exactMatchValidator<AnalyticsQueryRangeInterval>(['Daily', 'Weekly', 'Monthly']),
|
|
@@ -3888,6 +3948,7 @@ export const analyticsQueryValidator = orValidator<{ [K in AnalyticsQueryType]:
|
|
|
3888
3948
|
Field: stringValidatorOptionalEmptyOkay,
|
|
3889
3949
|
Tags: booleanValidatorOptional,
|
|
3890
3950
|
Age: booleanValidatorOptional,
|
|
3951
|
+
State: booleanValidatorOptional,
|
|
3891
3952
|
}, { isOptional: true, emptyOk: true }),
|
|
3892
3953
|
range: objectValidator<AnalyticsQueryRange<any>>({
|
|
3893
3954
|
interval: exactMatchValidator<AnalyticsQueryRangeInterval>(['Daily', 'Weekly', 'Monthly']),
|
|
@@ -3914,6 +3975,7 @@ export const analyticsQueryValidator = orValidator<{ [K in AnalyticsQueryType]:
|
|
|
3914
3975
|
Field: stringValidatorOptionalEmptyOkay,
|
|
3915
3976
|
Tags: booleanValidatorOptional,
|
|
3916
3977
|
Age: booleanValidatorOptional,
|
|
3978
|
+
State: booleanValidatorOptional,
|
|
3917
3979
|
}, { isOptional: true, emptyOk: true }),
|
|
3918
3980
|
range: objectValidator<AnalyticsQueryRange<any>>({
|
|
3919
3981
|
interval: exactMatchValidator<AnalyticsQueryRangeInterval>(['Daily', 'Weekly', 'Monthly']),
|
|
@@ -3937,6 +3999,7 @@ export const analyticsQueryValidator = orValidator<{ [K in AnalyticsQueryType]:
|
|
|
3937
3999
|
Field: stringValidatorOptionalEmptyOkay,
|
|
3938
4000
|
Tags: booleanValidatorOptional,
|
|
3939
4001
|
Age: booleanValidatorOptional,
|
|
4002
|
+
State: booleanValidatorOptional,
|
|
3940
4003
|
}, { isOptional: true, emptyOk: true }),
|
|
3941
4004
|
range: objectValidator<AnalyticsQueryRange<any>>({
|
|
3942
4005
|
interval: exactMatchValidator<AnalyticsQueryRangeInterval>(['Daily', 'Weekly', 'Monthly']),
|
|
@@ -3958,7 +4021,8 @@ export const analyticsQueryValidator = orValidator<{ [K in AnalyticsQueryType]:
|
|
|
3958
4021
|
"Assigned To": booleanValidatorOptional,
|
|
3959
4022
|
Field: stringValidatorOptionalEmptyOkay,
|
|
3960
4023
|
Tags: booleanValidatorOptional,
|
|
3961
|
-
Age: booleanValidatorOptional,
|
|
4024
|
+
Age: booleanValidatorOptional,
|
|
4025
|
+
State: booleanValidatorOptional,
|
|
3962
4026
|
}, { isOptional: true, emptyOk: true }),
|
|
3963
4027
|
range: objectValidator<AnalyticsQueryRange<any>>({
|
|
3964
4028
|
interval: exactMatchValidator<AnalyticsQueryRangeInterval>(['Daily', 'Weekly', 'Monthly']),
|
|
@@ -4141,7 +4205,7 @@ export const phoneTreeActionValidator = orValidator<{ [K in PhoneTreeActionType]
|
|
|
4141
4205
|
info: objectValidator<PhoneTreeActions["Route Call"]['info']>({
|
|
4142
4206
|
byCareTeam: booleanValidatorOptional,
|
|
4143
4207
|
byRole: stringValidatorOptional,
|
|
4144
|
-
byTags:
|
|
4208
|
+
byTags: listOfStringsWithQualifierValidatorOptionalValuesEmptyOkay,
|
|
4145
4209
|
playback: phonePlaybackValidatorOptional,
|
|
4146
4210
|
}),
|
|
4147
4211
|
}),
|