@tellescope/validation 1.120.0 → 1.122.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 +50 -3
- package/lib/cjs/validation.d.ts.map +1 -1
- package/lib/cjs/validation.js +70 -11
- package/lib/cjs/validation.js.map +1 -1
- package/lib/esm/validation.d.ts +50 -3
- package/lib/esm/validation.d.ts.map +1 -1
- package/lib/esm/validation.js +68 -9
- package/lib/esm/validation.js.map +1 -1
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/package.json +6 -6
- package/src/validation.ts +82 -8
package/src/validation.ts
CHANGED
|
@@ -284,6 +284,10 @@ import {
|
|
|
284
284
|
HealthieAddToCourseAutomationAction,
|
|
285
285
|
LabeledField,
|
|
286
286
|
HealthieSendChatAutomationAction,
|
|
287
|
+
ZusPullAutomationAction,
|
|
288
|
+
FieldMapping,
|
|
289
|
+
ActiveCampaignSyncAutomationAction,
|
|
290
|
+
AnalyticsFrameGroupingCategory,
|
|
287
291
|
} from "@tellescope/types-models"
|
|
288
292
|
import {
|
|
289
293
|
UserDisplayInfo,
|
|
@@ -314,6 +318,7 @@ import {
|
|
|
314
318
|
to_object_id,
|
|
315
319
|
} from "@tellescope/utilities"
|
|
316
320
|
import {
|
|
321
|
+
ACTIVE_CAMPAIGN_TITLE,
|
|
317
322
|
ALL_ACCESS,
|
|
318
323
|
ASSIGNED_ACCESS,
|
|
319
324
|
ATHENA_TITLE,
|
|
@@ -870,8 +875,8 @@ export const stringValidator100: ValidatorDefinition<string> = {
|
|
|
870
875
|
validate: (o={}) => build_validator(
|
|
871
876
|
escapeString(o), { ...o, maxLength: 100, listOf: false }
|
|
872
877
|
),
|
|
873
|
-
getExample:
|
|
874
|
-
getType:
|
|
878
|
+
getExample: getExampleString,
|
|
879
|
+
getType: getTypeString
|
|
875
880
|
}
|
|
876
881
|
|
|
877
882
|
export const stringValidator250: ValidatorDefinition<string> = {
|
|
@@ -2299,6 +2304,7 @@ const _AUTOMATION_ACTIONS: { [K in AutomationActionType]: any } = {
|
|
|
2299
2304
|
iterableCustomEvent: '',
|
|
2300
2305
|
zendeskCreateTicket: '',
|
|
2301
2306
|
zusSync: '',
|
|
2307
|
+
zusPull: '',
|
|
2302
2308
|
pagerDutyCreateIncident: '',
|
|
2303
2309
|
smartMeterPlaceOrder: '',
|
|
2304
2310
|
healthieSync: '',
|
|
@@ -2306,6 +2312,7 @@ const _AUTOMATION_ACTIONS: { [K in AutomationActionType]: any } = {
|
|
|
2306
2312
|
healthieSendChat: '',
|
|
2307
2313
|
completeTickets: '',
|
|
2308
2314
|
changeContactType: '',
|
|
2315
|
+
activeCampaignSync: '',
|
|
2309
2316
|
}
|
|
2310
2317
|
export const AUTOMATION_ACTIONS = Object.keys(_AUTOMATION_ACTIONS) as AutomationActionType[]
|
|
2311
2318
|
export const automationActionTypeValidator = exactMatchValidator<AutomationActionType>(AUTOMATION_ACTIONS)
|
|
@@ -2521,6 +2528,15 @@ export const ticketActionValidator = orValidator<{ [K in TicketActionType]: Tick
|
|
|
2521
2528
|
completedAt: dateOptionalOrEmptyStringValidator,
|
|
2522
2529
|
optional: booleanValidatorOptional,
|
|
2523
2530
|
}),
|
|
2531
|
+
"Send Email": objectValidator<TicketActions['Send Email']>({
|
|
2532
|
+
type: exactMatchValidator(['Send Email']),
|
|
2533
|
+
info: objectValidator<TicketActions['Send Email']['info']>({
|
|
2534
|
+
templateId: mongoIdStringRequired,
|
|
2535
|
+
emailId: mongoIdStringOptional,
|
|
2536
|
+
}, { emptyOk: false }),
|
|
2537
|
+
completedAt: dateOptionalOrEmptyStringValidator,
|
|
2538
|
+
optional: booleanValidatorOptional,
|
|
2539
|
+
}),
|
|
2524
2540
|
})
|
|
2525
2541
|
export const ticketActionsValidator = listValidatorOptionalOrEmptyOk(ticketActionValidator)
|
|
2526
2542
|
|
|
@@ -2556,7 +2572,12 @@ export const automationActionValidator = orValidator<{ [K in AutomationActionTyp
|
|
|
2556
2572
|
}),
|
|
2557
2573
|
sendEmail: objectValidator<SendEmailAutomationAction>({
|
|
2558
2574
|
type: exactMatchValidator(['sendEmail']),
|
|
2559
|
-
info:
|
|
2575
|
+
info: objectValidator<SendEmailAutomationAction['info']>({
|
|
2576
|
+
senderId: mongoIdStringRequired,
|
|
2577
|
+
templateId: mongoIdStringRequired,
|
|
2578
|
+
assignment: senderAssignmentStrategyValidatorOptional,
|
|
2579
|
+
fromEmailOverride: emailValidatorOptional,
|
|
2580
|
+
}, { emptyOk: false }),
|
|
2560
2581
|
continueOnError: booleanValidatorOptional,
|
|
2561
2582
|
}),
|
|
2562
2583
|
sendSMS: objectValidator<SendSMSAutomationAction>({
|
|
@@ -2571,6 +2592,7 @@ export const automationActionValidator = orValidator<{ [K in AutomationActionTyp
|
|
|
2571
2592
|
templateId: mongoIdStringRequired,
|
|
2572
2593
|
forAssigned: booleanValidator,
|
|
2573
2594
|
roles: listOfStringsValidatorOptionalOrEmptyOk,
|
|
2595
|
+
tags: listOfStringsWithQualifierValidatorOptionalValuesEmptyOkay,
|
|
2574
2596
|
},
|
|
2575
2597
|
{ emptyOk: false }
|
|
2576
2598
|
),
|
|
@@ -2747,6 +2769,11 @@ export const automationActionValidator = orValidator<{ [K in AutomationActionTyp
|
|
|
2747
2769
|
type: exactMatchValidator(['zusSync']),
|
|
2748
2770
|
info: objectValidator<ZusSyncAutomationAction['info']>({ }, { emptyOk: true }),
|
|
2749
2771
|
}),
|
|
2772
|
+
zusPull: objectValidator<ZusPullAutomationAction>({
|
|
2773
|
+
continueOnError: booleanValidatorOptional,
|
|
2774
|
+
type: exactMatchValidator(['zusPull']),
|
|
2775
|
+
info: objectValidator<ZusPullAutomationAction['info']>({ }, { emptyOk: true }),
|
|
2776
|
+
}),
|
|
2750
2777
|
pagerDutyCreateIncident: objectValidator<PagerDutyCreateIncidentAutomationAction>({
|
|
2751
2778
|
continueOnError: booleanValidatorOptional,
|
|
2752
2779
|
type: exactMatchValidator(['pagerDutyCreateIncident']),
|
|
@@ -2797,6 +2824,11 @@ export const automationActionValidator = orValidator<{ [K in AutomationActionTyp
|
|
|
2797
2824
|
type: stringValidatorOptional, // can be empty string for default contact type or id for others
|
|
2798
2825
|
}),
|
|
2799
2826
|
}),
|
|
2827
|
+
activeCampaignSync: objectValidator<ActiveCampaignSyncAutomationAction>({
|
|
2828
|
+
continueOnError: booleanValidatorOptional,
|
|
2829
|
+
type: exactMatchValidator(['activeCampaignSync']),
|
|
2830
|
+
info: objectValidator<ActiveCampaignSyncAutomationAction['info']>({ }, { emptyOk: true }),
|
|
2831
|
+
}),
|
|
2800
2832
|
})
|
|
2801
2833
|
|
|
2802
2834
|
export const journeyContextValidator = objectValidator<JourneyContext>({
|
|
@@ -3445,6 +3477,7 @@ const _CUSTOM_ENDUSER_FIELD_TYPES: { [K in CustomEnduserFieldType]: any } = {
|
|
|
3445
3477
|
"Auto Detect": true,
|
|
3446
3478
|
Table: true,
|
|
3447
3479
|
File: true,
|
|
3480
|
+
Number: true,
|
|
3448
3481
|
}
|
|
3449
3482
|
export const CUSTOM_ENDUSER_FIELD_TYPES = Object.keys(_CUSTOM_ENDUSER_FIELD_TYPES) as CustomEnduserFieldType[]
|
|
3450
3483
|
export const customEnduserFieldTypeValidator = exactMatchValidator<CustomEnduserFieldType>(CUSTOM_ENDUSER_FIELD_TYPES)
|
|
@@ -3492,6 +3525,14 @@ export const customEnduserFieldValidator = orValidator<{ [K in CustomEnduserFiel
|
|
|
3492
3525
|
hiddenFromProfile: booleanValidatorOptional,
|
|
3493
3526
|
requireConfirmation: booleanValidatorOptional,
|
|
3494
3527
|
}),
|
|
3528
|
+
Number: objectValidator<CustomEnduserFields['Number']>({
|
|
3529
|
+
type: exactMatchValidator(['Number']),
|
|
3530
|
+
info: optionalEmptyObjectValidator,
|
|
3531
|
+
field: stringValidator,
|
|
3532
|
+
required: booleanValidatorOptional,
|
|
3533
|
+
hiddenFromProfile: booleanValidatorOptional,
|
|
3534
|
+
requireConfirmation: booleanValidatorOptional,
|
|
3535
|
+
}),
|
|
3495
3536
|
File: objectValidator<CustomEnduserFields['File']>({
|
|
3496
3537
|
type: exactMatchValidator(['File']),
|
|
3497
3538
|
info: optionalEmptyObjectValidator,
|
|
@@ -3545,6 +3586,14 @@ export const buildInFieldsValidator = listValidatorOptionalOrEmptyOk(objectValid
|
|
|
3545
3586
|
requireConfirmation: booleanValidatorOptional,
|
|
3546
3587
|
}))
|
|
3547
3588
|
|
|
3589
|
+
export const customDashboardViewValidator = (
|
|
3590
|
+
objectValidator<Required<OrganizationSettings>['dashboard']['view']>({
|
|
3591
|
+
blocks: listValidatorOptionalOrEmptyOk(objectValidator<CustomDashboardViewBlock>({
|
|
3592
|
+
type: exactMatchValidator<CustomDashboardViewBlockType>(['Inbox', 'Tickets', 'Team Chats', 'Upcoming Events']),
|
|
3593
|
+
}))
|
|
3594
|
+
}, { isOptional: true, emptyOk: true })
|
|
3595
|
+
)
|
|
3596
|
+
|
|
3548
3597
|
export const organizationSettingsValidator = objectValidator<OrganizationSettings>({
|
|
3549
3598
|
endusers: objectValidator<OrganizationSettings['endusers']>({
|
|
3550
3599
|
disableMultipleChatRooms: booleanValidatorOptional,
|
|
@@ -3573,6 +3622,7 @@ export const organizationSettingsValidator = objectValidator<OrganizationSetting
|
|
|
3573
3622
|
inboxRepliesMarkRead: booleanValidatorOptional,
|
|
3574
3623
|
recordCallAudioPlayback: stringValidatorOptional,
|
|
3575
3624
|
disableAutoreplyForCustomEntities: booleanValidatorOptional,
|
|
3625
|
+
alwaysShowInsurance: booleanValidatorOptional,
|
|
3576
3626
|
}, { isOptional: true }),
|
|
3577
3627
|
tickets: objectValidator<OrganizationSettings['tickets']>({
|
|
3578
3628
|
defaultJourneyDueDateOffsetInMS: numberValidatorOptional,
|
|
@@ -3606,11 +3656,7 @@ export const organizationSettingsValidator = objectValidator<OrganizationSetting
|
|
|
3606
3656
|
locationRequired: booleanValidatorOptional,
|
|
3607
3657
|
}, { isOptional: true }),
|
|
3608
3658
|
dashboard: objectValidator<OrganizationSettings['dashboard']>({
|
|
3609
|
-
view:
|
|
3610
|
-
blocks: listValidatorOptionalOrEmptyOk(objectValidator<CustomDashboardViewBlock>({
|
|
3611
|
-
type: exactMatchValidator<CustomDashboardViewBlockType>(['Inbox', 'Tickets', 'Team Chats', 'Upcoming Events']),
|
|
3612
|
-
}))
|
|
3613
|
-
}, { isOptional: true, emptyOk: true, }),
|
|
3659
|
+
view: customDashboardViewValidator,
|
|
3614
3660
|
}, { isOptional: true, emptyOk: true, }),
|
|
3615
3661
|
users: objectValidator<OrganizationSettings['users']>({
|
|
3616
3662
|
sessionDurationInHours: numberValidatorOptional,
|
|
@@ -4234,6 +4280,7 @@ export type IntegrationsTitleType = (
|
|
|
4234
4280
|
| typeof ATHENA_TITLE
|
|
4235
4281
|
| typeof DOSESPOT_TITLE
|
|
4236
4282
|
| typeof DOCSUMO_TITLE
|
|
4283
|
+
| typeof ACTIVE_CAMPAIGN_TITLE
|
|
4237
4284
|
)
|
|
4238
4285
|
export const integrationTitleValidator = exactMatchValidator<IntegrationsTitleType>([
|
|
4239
4286
|
SQUARE_INTEGRATIONS_TITLE,
|
|
@@ -4252,6 +4299,7 @@ export const integrationTitleValidator = exactMatchValidator<IntegrationsTitleTy
|
|
|
4252
4299
|
ATHENA_TITLE,
|
|
4253
4300
|
DOSESPOT_TITLE,
|
|
4254
4301
|
DOCSUMO_TITLE,
|
|
4302
|
+
ACTIVE_CAMPAIGN_TITLE,
|
|
4255
4303
|
])
|
|
4256
4304
|
|
|
4257
4305
|
const _VIDEO_INTEGRATION_TYPES: { [K in VideoIntegrationType]: any} = {
|
|
@@ -4340,6 +4388,12 @@ export const analyticsQueryValidator = orValidator<{ [K in AnalyticsQueryType]:
|
|
|
4340
4388
|
method: exactMatchValidator<"Total">(['Total']),
|
|
4341
4389
|
parameters: optionalEmptyObjectValidator,
|
|
4342
4390
|
}),
|
|
4391
|
+
"Sum of Field": objectValidator<AnalyticsQueryInfoForType['Endusers']['Sum of Field']>({
|
|
4392
|
+
method: exactMatchValidator<"Sum of Field">(['Sum of Field']),
|
|
4393
|
+
parameters: objectValidator<{ field: string }>({
|
|
4394
|
+
field: stringValidator250,
|
|
4395
|
+
}),
|
|
4396
|
+
}),
|
|
4343
4397
|
}),
|
|
4344
4398
|
grouping: objectValidator<AnalyticsQueryGroupingForType['Endusers']>({
|
|
4345
4399
|
Gender: booleanValidatorOptional,
|
|
@@ -4718,6 +4772,13 @@ export const enduserProfileViewBlockValidator = orValidator<{ [K in EnduserProfi
|
|
|
4718
4772
|
fieldIds: listOfMongoIdStringValidatorEmptyOk,
|
|
4719
4773
|
}),
|
|
4720
4774
|
}),
|
|
4775
|
+
"Zus Encounters": objectValidator<EnduserProfileViewBlocks["Zus Encounters"]>({
|
|
4776
|
+
...sharedEnduserProfileViewBlockFields,
|
|
4777
|
+
type: exactMatchValidator(['Zus Encounters']),
|
|
4778
|
+
info: objectValidator<EnduserProfileViewBlocks['Zus Encounters']['info']>({
|
|
4779
|
+
title: stringValidator100,
|
|
4780
|
+
}),
|
|
4781
|
+
}),
|
|
4721
4782
|
})
|
|
4722
4783
|
export const enduserProfileViewBlocksValidator = listValidator(enduserProfileViewBlockValidator)
|
|
4723
4784
|
|
|
@@ -5064,3 +5125,16 @@ export const labeledFieldsValidator = listValidatorOptionalOrEmptyOk(objectValid
|
|
|
5064
5125
|
field: stringValidator100,
|
|
5065
5126
|
value: stringValidator5000,
|
|
5066
5127
|
}))
|
|
5128
|
+
|
|
5129
|
+
export const fieldMappingValidator = objectValidator<FieldMapping>({
|
|
5130
|
+
field: stringValidator250,
|
|
5131
|
+
externalField: stringValidator250,
|
|
5132
|
+
type: stringValidator100,
|
|
5133
|
+
})
|
|
5134
|
+
export const fieldMappingsValidator = listValidatorEmptyOk(fieldMappingValidator)
|
|
5135
|
+
|
|
5136
|
+
export const analyticsFrameGroupingCategoryValidator = objectValidator<AnalyticsFrameGroupingCategory>({
|
|
5137
|
+
category: stringValidator250,
|
|
5138
|
+
keys: listOfStringsValidatorEmptyOk,
|
|
5139
|
+
})
|
|
5140
|
+
export const analyticsFrameGroupingCategoriesValidator = listValidatorEmptyOk(analyticsFrameGroupingCategoryValidator)
|