@tellescope/validation 1.171.1 → 1.173.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 +31 -3
- package/lib/cjs/validation.d.ts.map +1 -1
- package/lib/cjs/validation.js +67 -4
- package/lib/cjs/validation.js.map +1 -1
- package/lib/esm/validation.d.ts +31 -3
- package/lib/esm/validation.d.ts.map +1 -1
- package/lib/esm/validation.js +63 -0
- package/lib/esm/validation.js.map +1 -1
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/package.json +7 -7
- package/src/validation.ts +68 -1
package/src/validation.ts
CHANGED
|
@@ -303,6 +303,9 @@ import {
|
|
|
303
303
|
ConditionResponse,
|
|
304
304
|
PushFormsAutomationAction,
|
|
305
305
|
FormResponseAnswerRichText,
|
|
306
|
+
DevelopHealthMedicationEligibilityAutomationAction,
|
|
307
|
+
RemoveFromAllJourneysAutomationAction,
|
|
308
|
+
FormResponseAnswerChargebee,
|
|
306
309
|
} from "@tellescope/types-models"
|
|
307
310
|
import {
|
|
308
311
|
AppointmentBookingPage,
|
|
@@ -1533,6 +1536,7 @@ const _FORM_FIELD_TYPES: { [K in FormFieldType]: any } = {
|
|
|
1533
1536
|
Address: '',
|
|
1534
1537
|
Time: '',
|
|
1535
1538
|
Stripe: '',
|
|
1539
|
+
Chargebee: '',
|
|
1536
1540
|
Dropdown: '',
|
|
1537
1541
|
"Database Select": '',
|
|
1538
1542
|
Medications: '',
|
|
@@ -1550,6 +1554,7 @@ export const FORM_FIELD_TYPES = Object.keys(_FORM_FIELD_TYPES) as FormFieldType[
|
|
|
1550
1554
|
export const formFieldTypeValidator = exactMatchValidator<FormFieldType>(FORM_FIELD_TYPES)
|
|
1551
1555
|
|
|
1552
1556
|
export const FORM_FIELD_VALIDATORS_BY_TYPE: { [K in FormFieldType | 'userEmail' | 'phoneNumber']: (value?: FormResponseValueAnswer[keyof FormResponseValueAnswer], options?: any, isOptional?: boolean) => any } = {
|
|
1557
|
+
'Chargebee': objectAnyFieldsAnyValuesValidator.validate(),
|
|
1553
1558
|
'Allergies': objectAnyFieldsAnyValuesValidator.validate(),
|
|
1554
1559
|
'Conditions': objectAnyFieldsAnyValuesValidator.validate(),
|
|
1555
1560
|
"Emotii": stringValidator.validate({ maxLength: 5000 }),
|
|
@@ -2132,6 +2137,12 @@ export const formResponseAnswerValidator = orValidator<{ [K in FormFieldType]: F
|
|
|
2132
2137
|
})
|
|
2133
2138
|
),
|
|
2134
2139
|
}),
|
|
2140
|
+
Chargebee: objectValidator<FormResponseAnswerChargebee>({
|
|
2141
|
+
type: exactMatchValidator(['Chargebee']),
|
|
2142
|
+
value: objectValidator<Required<FormResponseAnswerChargebee>['value']>({
|
|
2143
|
+
url: stringValidatorOptional
|
|
2144
|
+
}, { emptyOk: true, isOptional: true })
|
|
2145
|
+
})
|
|
2135
2146
|
})
|
|
2136
2147
|
|
|
2137
2148
|
export const mmddyyyyRegex = /^\d{2}-\d{2}-\d{4}$/
|
|
@@ -2338,6 +2349,7 @@ export const meetingDisplayInfoValidator = indexableValidator(mongoIdStringRequi
|
|
|
2338
2349
|
|
|
2339
2350
|
export const chatRoomUserInfoValidator = objectAnyFieldsValidator(objectValidator<ChatRoomUserInfo>({
|
|
2340
2351
|
unreadCount: nonNegNumberValidator,
|
|
2352
|
+
markedUnread: booleanValidatorOptional,
|
|
2341
2353
|
}))
|
|
2342
2354
|
|
|
2343
2355
|
const _LIST_QUERY_QUALIFIERS: { [K in ListQueryQualifier]: any} = {
|
|
@@ -2401,6 +2413,7 @@ const _AUTOMATION_ACTIONS: { [K in AutomationActionType]: any } = {
|
|
|
2401
2413
|
removeEnduserTags: '',
|
|
2402
2414
|
addToJourney: '',
|
|
2403
2415
|
removeFromJourney: '',
|
|
2416
|
+
removeFromAllJourneys: '',
|
|
2404
2417
|
iterableSendEmail: '',
|
|
2405
2418
|
iterableCustomEvent: '',
|
|
2406
2419
|
zendeskCreateTicket: '',
|
|
@@ -2418,6 +2431,7 @@ const _AUTOMATION_ACTIONS: { [K in AutomationActionType]: any } = {
|
|
|
2418
2431
|
switchToRelatedContact: '',
|
|
2419
2432
|
canvasSync: '',
|
|
2420
2433
|
elationSync: '',
|
|
2434
|
+
developHealthMedEligibility: '',
|
|
2421
2435
|
}
|
|
2422
2436
|
export const AUTOMATION_ACTIONS = Object.keys(_AUTOMATION_ACTIONS) as AutomationActionType[]
|
|
2423
2437
|
export const automationActionTypeValidator = exactMatchValidator<AutomationActionType>(AUTOMATION_ACTIONS)
|
|
@@ -2672,7 +2686,30 @@ export const automationForMessageValidator = objectValidator<AutomationForMessag
|
|
|
2672
2686
|
sendToDestinationOfRelatedContactTypes: listOfStringsValidatorOptionalOrEmptyOk,
|
|
2673
2687
|
}, { emptyOk: false })
|
|
2674
2688
|
|
|
2689
|
+
export const developHealthDrugsValidator = listValidator(objectValidator<{ name: string, dosage: string, quantity: number }>({
|
|
2690
|
+
name: stringValidator,
|
|
2691
|
+
dosage: stringValidator,
|
|
2692
|
+
quantity: numberValidator,
|
|
2693
|
+
}))
|
|
2694
|
+
export const developHealthDiagnosesValidator = listValidatorEmptyOk(objectValidator<{ code: string }>({
|
|
2695
|
+
code: stringValidator,
|
|
2696
|
+
}))
|
|
2697
|
+
export const developHealthMockResultValidator = objectValidator<{ status: string, case: string }>({
|
|
2698
|
+
status: stringValidator,
|
|
2699
|
+
case: stringValidator,
|
|
2700
|
+
}, { emptyOk: true, isOptional: true })
|
|
2701
|
+
|
|
2675
2702
|
export const automationActionValidator = orValidator<{ [K in AutomationActionType]: AutomationAction & { type: K } } >({
|
|
2703
|
+
developHealthMedEligibility: objectValidator<DevelopHealthMedicationEligibilityAutomationAction>({
|
|
2704
|
+
type: exactMatchValidator(['developHealthMedEligibility']),
|
|
2705
|
+
info: objectValidator<DevelopHealthMedicationEligibilityAutomationAction['info']>({
|
|
2706
|
+
drugs: developHealthDrugsValidator,
|
|
2707
|
+
diagnoses: developHealthDiagnosesValidator,
|
|
2708
|
+
mock_result: developHealthMockResultValidator,
|
|
2709
|
+
providerUserId: mongoIdStringRequired,
|
|
2710
|
+
}, { emptyOk: false }),
|
|
2711
|
+
continueOnError: booleanValidatorOptional,
|
|
2712
|
+
}),
|
|
2676
2713
|
setEnduserStatus: objectValidator<SetEnduserStatusAutomationAction>({
|
|
2677
2714
|
type: exactMatchValidator(['setEnduserStatus']),
|
|
2678
2715
|
info: objectValidator<SetEnduserStatusInfo>({ status: stringValidator250 }, { emptyOk: false }),
|
|
@@ -2814,6 +2851,7 @@ export const automationActionValidator = orValidator<{ [K in AutomationActionTyp
|
|
|
2814
2851
|
type: exactMatchValidator(['addEnduserTags']),
|
|
2815
2852
|
info: objectValidator<AddEnduserTagsAutomationAction['info']>({
|
|
2816
2853
|
tags: listOfStringsValidator,
|
|
2854
|
+
replaceExisting: booleanValidatorOptional,
|
|
2817
2855
|
}, { emptyOk: false }),
|
|
2818
2856
|
}),
|
|
2819
2857
|
removeEnduserTags: objectValidator<RemoveEnduserTagsAutomationAction>({
|
|
@@ -2837,6 +2875,11 @@ export const automationActionValidator = orValidator<{ [K in AutomationActionTyp
|
|
|
2837
2875
|
journeyId: mongoIdStringRequired,
|
|
2838
2876
|
}, { emptyOk: false }),
|
|
2839
2877
|
}),
|
|
2878
|
+
removeFromAllJourneys: objectValidator<RemoveFromAllJourneysAutomationAction>({
|
|
2879
|
+
continueOnError: booleanValidatorOptional,
|
|
2880
|
+
type: exactMatchValidator(['removeFromAllJourneys']),
|
|
2881
|
+
info: objectValidator<RemoveFromAllJourneysAutomationAction['info']>({}, { emptyOk: true, isOptional: true }),
|
|
2882
|
+
}),
|
|
2840
2883
|
iterableSendEmail: objectValidator<IterableSendEmailAutomationAction>({
|
|
2841
2884
|
continueOnError: booleanValidatorOptional,
|
|
2842
2885
|
type: exactMatchValidator(['iterableSendEmail']),
|
|
@@ -3007,6 +3050,7 @@ export const journeyContextValidator = objectValidator<JourneyContext>({
|
|
|
3007
3050
|
publicIdentifier: stringValidatorOptional,
|
|
3008
3051
|
databaseRecordId: mongoIdStringOptional,
|
|
3009
3052
|
databaseRecordCreator: mongoIdStringOptional,
|
|
3053
|
+
eligibilityResultId: mongoIdStringOptional,
|
|
3010
3054
|
})
|
|
3011
3055
|
|
|
3012
3056
|
export const relatedRecordValidator = objectValidator<RelatedRecord>({
|
|
@@ -3187,6 +3231,7 @@ const _TABLE_INPUT_TYPES: { [K in TableInputChoiceType]: any } = {
|
|
|
3187
3231
|
Date: '',
|
|
3188
3232
|
Text: '',
|
|
3189
3233
|
Select: '',
|
|
3234
|
+
Database: '',
|
|
3190
3235
|
}
|
|
3191
3236
|
export const TABLE_INPUT_TYPES = Object.keys(_TABLE_INPUT_TYPES) as TableInputChoiceType[]
|
|
3192
3237
|
export const tableInputTypesValidator = exactMatchValidator<TableInputChoiceType>(TABLE_INPUT_TYPES)
|
|
@@ -3209,6 +3254,14 @@ export const tableInputChoiceValidator = orValidator<{ [K in TableInputChoiceTyp
|
|
|
3209
3254
|
choices: listOfStringsValidator,
|
|
3210
3255
|
}),
|
|
3211
3256
|
}),
|
|
3257
|
+
Database: objectValidator<TableInputChoices['Database']>({
|
|
3258
|
+
type: exactMatchValidator<'Database'>(['Database']),
|
|
3259
|
+
label: stringValidator1000,
|
|
3260
|
+
info: objectValidator<TableInputChoices['Database']['info']>({
|
|
3261
|
+
databaseId: mongoIdStringRequired,
|
|
3262
|
+
databaseLabel: stringValidator1000,
|
|
3263
|
+
}),
|
|
3264
|
+
}),
|
|
3212
3265
|
})
|
|
3213
3266
|
|
|
3214
3267
|
export const formFieldFeedbackValidator = objectValidator<FormFieldFeedback>({
|
|
@@ -3298,6 +3351,8 @@ export const formFieldOptionsValidator = objectValidator<FormFieldOptions>({
|
|
|
3298
3351
|
observationDisplay: stringValidatorOptionalEmptyOkay,
|
|
3299
3352
|
observationUnit: stringValidatorOptionalEmptyOkay,
|
|
3300
3353
|
autoUploadFiles: booleanValidatorOptional,
|
|
3354
|
+
chargebeeEnvironment: stringValidatorOptional,
|
|
3355
|
+
chargebeePlanId: stringValidatorOptional,
|
|
3301
3356
|
})
|
|
3302
3357
|
|
|
3303
3358
|
export const blockValidator = orValidator<{ [K in BlockType]: Block & { type: K } } >({
|
|
@@ -4019,6 +4074,7 @@ const _AUTOMATION_TRIGGER_EVENT_TYPES: { [K in AutomationTriggerEventType]: any
|
|
|
4019
4074
|
"Message Link Clicked": true,
|
|
4020
4075
|
"Healthie Note Locked": true,
|
|
4021
4076
|
"Database Entry Added": true,
|
|
4077
|
+
"Eligibility Result Received": true,
|
|
4022
4078
|
}
|
|
4023
4079
|
export const AUTOMATION_TRIGGER_EVENT_TYPES = Object.keys(_AUTOMATION_TRIGGER_EVENT_TYPES) as AutomationTriggerEventType[]
|
|
4024
4080
|
|
|
@@ -4280,6 +4336,12 @@ export const automationTriggerEventValidator = orValidator<{ [K in AutomationTri
|
|
|
4280
4336
|
}, { emptyOk: true }),
|
|
4281
4337
|
conditions: optionalEmptyObjectValidator,
|
|
4282
4338
|
}),
|
|
4339
|
+
"Eligibility Result Received": objectValidator<AutomationTriggerEvents["Eligibility Result Received"]>({
|
|
4340
|
+
type: exactMatchValidator(['Eligibility Result Received']),
|
|
4341
|
+
info: objectValidator<AutomationTriggerEvents['Eligibility Result Received']['info']>({
|
|
4342
|
+
source: stringValidator100,
|
|
4343
|
+
}),
|
|
4344
|
+
}),
|
|
4283
4345
|
})
|
|
4284
4346
|
|
|
4285
4347
|
const _AUTOMATION_TRIGGER_ACTION_TYPES: { [K in AutomationTriggerActionType]: any } = {
|
|
@@ -4321,6 +4383,7 @@ export const automationTriggerActionValidator = orValidator<{ [K in AutomationTr
|
|
|
4321
4383
|
type: exactMatchValidator(['Add Tags']),
|
|
4322
4384
|
info: objectValidator<AutomationTriggerActions['Add Tags']['info']>({
|
|
4323
4385
|
tags: listOfStringsValidator,
|
|
4386
|
+
replaceExisting: booleanValidatorOptional,
|
|
4324
4387
|
}),
|
|
4325
4388
|
}),
|
|
4326
4389
|
"Remove Tags": objectValidator<AutomationTriggerActions["Remove Tags"]>({
|
|
@@ -4378,7 +4441,7 @@ export const automationTriggerActionValidator = orValidator<{ [K in AutomationTr
|
|
|
4378
4441
|
info: objectValidator<AutomationTriggerActions['Require Form Followups']['info']>({
|
|
4379
4442
|
formIds: listOfUniqueStringsValidatorEmptyOk,
|
|
4380
4443
|
}),
|
|
4381
|
-
}),
|
|
4444
|
+
}),
|
|
4382
4445
|
})
|
|
4383
4446
|
|
|
4384
4447
|
|
|
@@ -4798,6 +4861,7 @@ export const analyticsQueryValidator = orValidator<{ [K in AnalyticsQueryType]:
|
|
|
4798
4861
|
to: dateOptionalOrEmptyStringValidator,
|
|
4799
4862
|
}, { isOptional: true }),
|
|
4800
4863
|
tags: listOfStringsWithQualifierValidatorOptional,
|
|
4864
|
+
entityTypes: listOfStringsValidatorOptionalOrEmptyOk,
|
|
4801
4865
|
}, { isOptional: true, emptyOk: true }),
|
|
4802
4866
|
info: orValidator<{ [K in keyof AnalyticsQueryInfoForType['Endusers']]: AnalyticsQueryInfoForType['Endusers'][K] }>({
|
|
4803
4867
|
"Total": objectValidator<AnalyticsQueryInfoForType['Endusers']['Total']>({
|
|
@@ -5441,6 +5505,7 @@ export const phoneTreeActionValidator = orValidator<{ [K in PhoneTreeActionType]
|
|
|
5441
5505
|
playback: phonePlaybackValidatorOptional,
|
|
5442
5506
|
duration: numberValidatorOptional,
|
|
5443
5507
|
addToCareTeam: booleanValidatorOptional,
|
|
5508
|
+
dialRecentAgent: booleanValidatorOptional,
|
|
5444
5509
|
}),
|
|
5445
5510
|
}),
|
|
5446
5511
|
"Forward Call": objectValidator<PhoneTreeActions["Forward Call"]>({
|
|
@@ -5455,6 +5520,7 @@ export const phoneTreeActionValidator = orValidator<{ [K in PhoneTreeActionType]
|
|
|
5455
5520
|
weeklyAvailabilities: weeklyAvailabilitiesValidator,
|
|
5456
5521
|
timezone: timezoneValidatorOptional,
|
|
5457
5522
|
hasCareTeam: booleanValidatorOptional,
|
|
5523
|
+
hasOneCareTeamMember: booleanValidatorOptional,
|
|
5458
5524
|
}),
|
|
5459
5525
|
}),
|
|
5460
5526
|
"Select Care Team Member": objectValidator<PhoneTreeActions["Select Care Team Member"]>({
|
|
@@ -5611,6 +5677,7 @@ export const mmsMessagesValidator = listValidator(mmsMessageValidator)
|
|
|
5611
5677
|
export const groupMMSUserStateValidator = objectValidator<GroupMMSUserState>({
|
|
5612
5678
|
numUnread: nonNegNumberValidator,
|
|
5613
5679
|
id: stringValidator,
|
|
5680
|
+
markedUnread: booleanValidatorOptional,
|
|
5614
5681
|
})
|
|
5615
5682
|
export const groupMMSUserStatesValidator = listValidatorOptionalOrEmptyOk(groupMMSUserStateValidator)
|
|
5616
5683
|
|