@tellescope/validation 1.223.0 → 1.225.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 +36 -2
- package/lib/cjs/validation.d.ts.map +1 -1
- package/lib/cjs/validation.js +69 -4
- package/lib/cjs/validation.js.map +1 -1
- package/lib/esm/validation.d.ts +36 -2
- package/lib/esm/validation.d.ts.map +1 -1
- package/lib/esm/validation.js +65 -0
- package/lib/esm/validation.js.map +1 -1
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/package.json +7 -7
- package/src/validation.ts +72 -3
package/src/validation.ts
CHANGED
|
@@ -330,6 +330,8 @@ import {
|
|
|
330
330
|
AIDecisionAutomationAction,
|
|
331
331
|
AssignInboxItemAutomationAction,
|
|
332
332
|
OnAIDecisionAutomationEvent,
|
|
333
|
+
OnErrorEventInfo,
|
|
334
|
+
OnErrorAutomationEvent,
|
|
333
335
|
AIContextSource,
|
|
334
336
|
} from "@tellescope/types-models"
|
|
335
337
|
import {
|
|
@@ -2447,6 +2449,7 @@ const _AUTOMATION_EVENTS: { [K in AutomationEventType]: any } = {
|
|
|
2447
2449
|
waitForTrigger: '',
|
|
2448
2450
|
onCallOutcome: '',
|
|
2449
2451
|
onAIDecision: '',
|
|
2452
|
+
onError: '',
|
|
2450
2453
|
}
|
|
2451
2454
|
export const AUTOMATION_EVENTS = Object.keys(_AUTOMATION_EVENTS) as AutomationEventType[]
|
|
2452
2455
|
export const automationEventTypeValidator = exactMatchValidator<AutomationEventType>(AUTOMATION_EVENTS)
|
|
@@ -2696,11 +2699,17 @@ export const automationEventValidator = orValidator<{ [K in AutomationEventType]
|
|
|
2696
2699
|
}),
|
|
2697
2700
|
onAIDecision: objectValidator<OnAIDecisionAutomationEvent>({
|
|
2698
2701
|
type: exactMatchValidator(['onAIDecision']),
|
|
2699
|
-
info: objectValidator<OnAIDecisionAutomationEvent['info']>({
|
|
2700
|
-
automationStepId: mongoIdStringRequired,
|
|
2702
|
+
info: objectValidator<OnAIDecisionAutomationEvent['info']>({
|
|
2703
|
+
automationStepId: mongoIdStringRequired,
|
|
2701
2704
|
outcomes: listOfStringsValidator,
|
|
2702
2705
|
}, { emptyOk: false }),
|
|
2703
2706
|
}),
|
|
2707
|
+
onError: objectValidator<OnErrorAutomationEvent>({
|
|
2708
|
+
type: exactMatchValidator(['onError']),
|
|
2709
|
+
info: objectValidator<OnErrorEventInfo>({
|
|
2710
|
+
automationStepId: mongoIdStringRequired,
|
|
2711
|
+
}, { emptyOk: false }),
|
|
2712
|
+
}),
|
|
2704
2713
|
})
|
|
2705
2714
|
export const automationEventsValidator = listValidatorEmptyOk(automationEventValidator)
|
|
2706
2715
|
|
|
@@ -3084,6 +3093,7 @@ export const automationActionValidator = orValidator<{ [K in AutomationActionTyp
|
|
|
3084
3093
|
type: exactMatchValidator(['metriportSync']),
|
|
3085
3094
|
info: objectValidator<MetriportSyncAutomationAction['info']>({
|
|
3086
3095
|
facilityId: stringValidator1000,
|
|
3096
|
+
integrationTitle: stringValidatorOptionalEmptyOkay,
|
|
3087
3097
|
}, { emptyOk: true }),
|
|
3088
3098
|
}),
|
|
3089
3099
|
zusSync: objectValidator<ZusSyncAutomationAction>({
|
|
@@ -3278,9 +3288,10 @@ export const automationActionValidator = orValidator<{ [K in AutomationActionTyp
|
|
|
3278
3288
|
stripeChargeCardOnFile: objectValidator<StripeChargeCardOnFileAutomationAction>({
|
|
3279
3289
|
...sharedAutomationActionValidators,
|
|
3280
3290
|
type: exactMatchValidator(['stripeChargeCardOnFile']),
|
|
3281
|
-
info: objectValidator<StripeChargeCardOnFileAutomationAction['info']>({
|
|
3291
|
+
info: objectValidator<StripeChargeCardOnFileAutomationAction['info']>({
|
|
3282
3292
|
stripeKey: stringValidatorOptionalEmptyOkay,
|
|
3283
3293
|
priceIds: listOfStringsValidatorEmptyOk,
|
|
3294
|
+
productIds: listOfStringsValidatorOptionalOrEmptyOk,
|
|
3284
3295
|
subscriptionPriceId: stringValidatorOptionalEmptyOkay,
|
|
3285
3296
|
}, { emptyOk: false }) // at least tags is required
|
|
3286
3297
|
}),
|
|
@@ -3329,6 +3340,8 @@ export const journeyContextValidator = objectValidator<JourneyContext>({
|
|
|
3329
3340
|
fileId: mongoIdStringOptional,
|
|
3330
3341
|
chatRoomId: mongoIdStringOptional,
|
|
3331
3342
|
twilioNumber: stringValidatorOptionalEmptyOkay,
|
|
3343
|
+
ticketThreadId: mongoIdStringOptional,
|
|
3344
|
+
ticketThreadCommentId: mongoIdStringOptional,
|
|
3332
3345
|
})
|
|
3333
3346
|
|
|
3334
3347
|
export const relatedRecordValidator = objectValidator<RelatedRecord>({
|
|
@@ -3582,6 +3595,7 @@ export const formFieldOptionsValidator = objectValidator<FormFieldOptions>({
|
|
|
3582
3595
|
})),
|
|
3583
3596
|
validFileTypes: listOfStringsValidatorOptionalOrEmptyOk,
|
|
3584
3597
|
maxFileSize: numberValidatorOptional,
|
|
3598
|
+
hideFromPortal: booleanValidatorOptional,
|
|
3585
3599
|
productIds: listOfStringsValidatorOptionalOrEmptyOk,
|
|
3586
3600
|
chargeImmediately: booleanValidatorOptional,
|
|
3587
3601
|
signatureUrl: stringValidator5000Optional,
|
|
@@ -3655,74 +3669,95 @@ export const formFieldOptionsValidator = objectValidator<FormFieldOptions>({
|
|
|
3655
3669
|
allowAddToDatabase: booleanValidatorOptional,
|
|
3656
3670
|
})
|
|
3657
3671
|
|
|
3672
|
+
export const blockStyleValidator = objectValidator({
|
|
3673
|
+
width: numberValidatorOptional,
|
|
3674
|
+
height: numberValidatorOptional,
|
|
3675
|
+
backgroundColor: stringValidatorOptional,
|
|
3676
|
+
borderColor: stringValidatorOptional,
|
|
3677
|
+
borderWidth: numberValidatorOptional,
|
|
3678
|
+
textColor: stringValidatorOptional,
|
|
3679
|
+
}, { isOptional: true, emptyOk: true })
|
|
3680
|
+
|
|
3658
3681
|
export const blockValidator = orValidator<{ [K in BlockType]: Block & { type: K } } >({
|
|
3659
3682
|
h1: objectValidator<BlockContentH1>({
|
|
3660
3683
|
type: exactMatchValidator(['h1']),
|
|
3661
3684
|
info: objectValidator<BlockContentH1['info']>({
|
|
3662
3685
|
text: stringValidator5000EmptyOkay,
|
|
3663
3686
|
}),
|
|
3687
|
+
style: blockStyleValidator,
|
|
3664
3688
|
}),
|
|
3665
3689
|
h2: objectValidator<BlockContentH2>({
|
|
3666
3690
|
type: exactMatchValidator(['h2']),
|
|
3667
3691
|
info: objectValidator<BlockContentH1['info']>({
|
|
3668
3692
|
text: stringValidator5000EmptyOkay,
|
|
3669
3693
|
}),
|
|
3694
|
+
style: blockStyleValidator,
|
|
3670
3695
|
}),
|
|
3671
3696
|
html: objectValidator<BlockContentHTML>({
|
|
3672
3697
|
type: exactMatchValidator(['html']),
|
|
3673
3698
|
info: objectValidator<BlockContentHTML['info']>({
|
|
3674
3699
|
html: stringValidator25000EmptyOkay,
|
|
3675
3700
|
}),
|
|
3701
|
+
style: blockStyleValidator,
|
|
3676
3702
|
}),
|
|
3677
3703
|
image: objectValidator<BlockContentImage>({
|
|
3678
3704
|
type: exactMatchValidator(['image']),
|
|
3679
3705
|
info: objectValidator<BlockContentImage['info']>({
|
|
3680
3706
|
link: stringValidator5000EmptyOkay,
|
|
3681
3707
|
name: stringValidatorOptional,
|
|
3708
|
+
alt: stringValidatorOptional,
|
|
3682
3709
|
height: numberValidatorOptional,
|
|
3683
3710
|
maxHeight: numberValidatorOptional,
|
|
3684
3711
|
width: numberValidatorOptional,
|
|
3685
3712
|
maxWidth: numberValidatorOptional,
|
|
3686
3713
|
}),
|
|
3714
|
+
style: blockStyleValidator,
|
|
3687
3715
|
}),
|
|
3688
3716
|
pdf: objectValidator<BlockContentPDF>({
|
|
3689
3717
|
type: exactMatchValidator(['pdf']),
|
|
3690
3718
|
info: objectValidator<BlockContentPDF['info']>({
|
|
3691
3719
|
link: stringValidator5000EmptyOkay,
|
|
3692
3720
|
name: stringValidatorOptional,
|
|
3721
|
+
alt: stringValidatorOptional,
|
|
3693
3722
|
height: numberValidatorOptional,
|
|
3694
3723
|
maxHeight: numberValidatorOptional,
|
|
3695
3724
|
width: numberValidatorOptional,
|
|
3696
3725
|
maxWidth: numberValidatorOptional,
|
|
3697
3726
|
}),
|
|
3727
|
+
style: blockStyleValidator,
|
|
3698
3728
|
}),
|
|
3699
3729
|
youtube: objectValidator<BlockContentYoutube>({
|
|
3700
3730
|
type: exactMatchValidator(['youtube']),
|
|
3701
3731
|
info: objectValidator<BlockContentYoutube['info']>({
|
|
3702
3732
|
link: stringValidator5000EmptyOkay,
|
|
3703
3733
|
name: stringValidatorOptional,
|
|
3734
|
+
alt: stringValidatorOptional,
|
|
3704
3735
|
height: numberValidatorOptional,
|
|
3705
3736
|
maxHeight: numberValidatorOptional,
|
|
3706
3737
|
width: numberValidatorOptional,
|
|
3707
3738
|
maxWidth: numberValidatorOptional,
|
|
3708
3739
|
}),
|
|
3740
|
+
style: blockStyleValidator,
|
|
3709
3741
|
}),
|
|
3710
3742
|
iframe: objectValidator<BlockContentIFrame>({
|
|
3711
3743
|
type: exactMatchValidator(['iframe']),
|
|
3712
3744
|
info: objectValidator<BlockContentIFrame['info']>({
|
|
3713
3745
|
link: stringValidator5000EmptyOkay,
|
|
3714
3746
|
name: stringValidatorOptional,
|
|
3747
|
+
alt: stringValidatorOptional,
|
|
3715
3748
|
height: numberValidatorOptional,
|
|
3716
3749
|
maxHeight: numberValidatorOptional,
|
|
3717
3750
|
width: numberValidatorOptional,
|
|
3718
3751
|
maxWidth: numberValidatorOptional,
|
|
3719
3752
|
}),
|
|
3753
|
+
style: blockStyleValidator,
|
|
3720
3754
|
}),
|
|
3721
3755
|
"content-link": objectValidator<BlockContentLink>({
|
|
3722
3756
|
type: exactMatchValidator(["content-link"]),
|
|
3723
3757
|
info: objectValidator<BlockContentLink['info']>({
|
|
3724
3758
|
recordId: mongoIdStringRequired,
|
|
3725
3759
|
}),
|
|
3760
|
+
style: blockStyleValidator,
|
|
3726
3761
|
}),
|
|
3727
3762
|
})
|
|
3728
3763
|
|
|
@@ -4026,6 +4061,13 @@ export const portalBlockValidator = orValidator<{ [K in PortalBlockType]: Portal
|
|
|
4026
4061
|
info: objectValidator<PortalBlockForType['HTML']['info']>({
|
|
4027
4062
|
html: stringValidator5000,
|
|
4028
4063
|
})
|
|
4064
|
+
}),
|
|
4065
|
+
pinnedForms: objectValidator<PortalBlockForType['pinnedForms']>({
|
|
4066
|
+
type: exactMatchValidator(['pinnedForms']),
|
|
4067
|
+
info: objectValidator<PortalBlockForType['pinnedForms']['info']>({
|
|
4068
|
+
title: stringValidatorOptional,
|
|
4069
|
+
formIds: listOfMongoIdStringValidatorEmptyOk,
|
|
4070
|
+
})
|
|
4029
4071
|
}),
|
|
4030
4072
|
})
|
|
4031
4073
|
export const portalBlocksValidator = listValidatorEmptyOk(portalBlockValidator)
|
|
@@ -4040,6 +4082,7 @@ const _PORTAL_BLOCK_TYPES: { [K in PortalBlockType]: any } = {
|
|
|
4040
4082
|
"Manage Subscription Button": '',
|
|
4041
4083
|
Orders: '',
|
|
4042
4084
|
HTML: '',
|
|
4085
|
+
pinnedForms: '',
|
|
4043
4086
|
}
|
|
4044
4087
|
export const PORTAL_BLOCK_TYPES = Object.keys(_PORTAL_BLOCK_TYPES) as PortalBlockType[]
|
|
4045
4088
|
export const portalTypeValidator = exactMatchValidator<PortalBlockType>(PORTAL_BLOCK_TYPES)
|
|
@@ -4755,6 +4798,9 @@ const _AUTOMATION_TRIGGER_ACTION_TYPES: { [K in AutomationTriggerActionType]: an
|
|
|
4755
4798
|
"Add to Waitlist": true,
|
|
4756
4799
|
"Grant Access From Waitlist": true,
|
|
4757
4800
|
"Reply to Chat": true,
|
|
4801
|
+
"Create User Notifications": true,
|
|
4802
|
+
"Assign to Incoming Message": true,
|
|
4803
|
+
"Zendesk: Update Ticket Assignee": true,
|
|
4758
4804
|
}
|
|
4759
4805
|
export const AUTOMATION_TRIGGER_ACTION_TYPES = Object.keys(_AUTOMATION_TRIGGER_ACTION_TYPES) as AutomationTriggerActionType[]
|
|
4760
4806
|
|
|
@@ -4859,6 +4905,29 @@ export const automationTriggerActionValidator = orValidator<{ [K in AutomationTr
|
|
|
4859
4905
|
message: stringValidator,
|
|
4860
4906
|
}),
|
|
4861
4907
|
}),
|
|
4908
|
+
"Create User Notifications": objectValidator<AutomationTriggerActions["Create User Notifications"]>({
|
|
4909
|
+
type: exactMatchValidator(['Create User Notifications']),
|
|
4910
|
+
info: objectValidator<AutomationTriggerActions['Create User Notifications']['info']>({
|
|
4911
|
+
message: stringValidator,
|
|
4912
|
+
notificationType: stringValidator,
|
|
4913
|
+
careTeamOnly: booleanValidatorOptional,
|
|
4914
|
+
tags: listOfStringsWithQualifierValidatorOptional,
|
|
4915
|
+
maxUsers: numberValidatorOptional,
|
|
4916
|
+
}),
|
|
4917
|
+
}),
|
|
4918
|
+
"Assign to Incoming Message": objectValidator<AutomationTriggerActions["Assign to Incoming Message"]>({
|
|
4919
|
+
type: exactMatchValidator(['Assign to Incoming Message']),
|
|
4920
|
+
info: objectValidator<AutomationTriggerActions['Assign to Incoming Message']['info']>({
|
|
4921
|
+
careTeamOnly: booleanValidatorOptional,
|
|
4922
|
+
tags: listOfStringsWithQualifierValidatorOptional,
|
|
4923
|
+
maxUsers: numberValidatorOptional,
|
|
4924
|
+
}),
|
|
4925
|
+
}),
|
|
4926
|
+
"Zendesk: Update Ticket Assignee": objectValidator<AutomationTriggerActions["Zendesk: Update Ticket Assignee"]>({
|
|
4927
|
+
type: exactMatchValidator(['Zendesk: Update Ticket Assignee']),
|
|
4928
|
+
info: objectValidator<AutomationTriggerActions['Zendesk: Update Ticket Assignee']['info']>({
|
|
4929
|
+
}),
|
|
4930
|
+
}),
|
|
4862
4931
|
})
|
|
4863
4932
|
|
|
4864
4933
|
|