@tellescope/schema 1.255.12 → 1.255.14

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/src/schema.ts CHANGED
@@ -99,6 +99,7 @@ import {
99
99
  TimeTrack,
100
100
  LinkedAccount,
101
101
  LinkedAccountAccessEntry,
102
+ MFAMethod,
102
103
  } from "@tellescope/types-models"
103
104
 
104
105
  import {
@@ -268,12 +269,14 @@ import {
268
269
  indexUpdatesValidator,
269
270
  dateRangeOptionalValidator,
270
271
  booleanValidatorOptional,
272
+ coldTransfersValidator,
271
273
  automationTriggerActionValidator,
272
274
  automationTriggerEventValidator,
273
275
  automatioNTriggerStatusValidator,
274
276
  exactMatchValidator,
275
277
  exactMatchValidatorOptional,
276
278
  listOfMongoIdStringValidatorOptionalOrEmptyOk,
279
+ listOfListsOfMongoIdStringsValidatorOptionalOrEmptyOk,
277
280
  linkedAccountAccessValidator,
278
281
  listOfStringsValidatorOptionalOrEmptyOk,
279
282
  stringValidatorOptionalEmptyOkay,
@@ -309,6 +312,7 @@ import {
309
312
  listValidatorOptionalOrEmptyOk,
310
313
  formCustomizationValidator,
311
314
  aiSummaryConfigurationValidator,
315
+ selectableAIModelValidator,
312
316
  buildInFieldsValidator,
313
317
  customEnduserFieldsValidatorOptionalOrEmpty,
314
318
  ticketActionsValidator,
@@ -948,7 +952,9 @@ export type CustomActions = {
948
952
  { created: UserClient }
949
953
  >
950
954
  configure_inbox: CustomAction<{ username: string, fname: string, lname: string }, { user: User, authToken: string }>,
951
- configure_MFA: CustomAction<{ disable?: boolean }, { recoveryCodes: string[], authToken: string, user: UserSession }>,
955
+ configure_MFA: CustomAction<{ disable?: boolean, method?: MFAMethod }, { recoveryCodes: string[], authToken: string, user: UserSession }>,
956
+ begin_TOTP_configuration: CustomAction<{}, { otpauthURL: string, secret: string }>,
957
+ confirm_TOTP_configuration: CustomAction<{ code: string }, { recoveryCodes: string[], authToken: string, user: UserSession }>,
952
958
  generate_MFA_challenge: CustomAction<{ method: string }, { }>,
953
959
  submit_MFA_challenge: CustomAction<{ code: string }, { authToken: string, user: UserSession }>,
954
960
  get_engagement_report: CustomAction<{ range?: DateRange, excludeAutomated?: boolean }, { report: Record<string, any> }>,
@@ -1122,6 +1128,7 @@ export type CustomActions = {
1122
1128
  }, { report: Report }>,
1123
1129
  get_number_report: CustomAction<{ range?: DateRange }, { report: PhoneCallsReport }>,
1124
1130
  upgrade_to_conference: CustomAction<{ id: string }, { }>,
1131
+ cold_transfer: CustomAction<{ callSid: string, targetUserId: string }, { }>,
1125
1132
  add_conference_attendees: CustomAction<{ conferenceId: string, enduserId?: string, byClientId?: string[], byPhone?: string[] }, { }>,
1126
1133
  remove_conference_attendees: CustomAction<{ conferenceId: string, byClientId?: string[], byPhone?: string[] }, { }>,
1127
1134
  end_conference: CustomAction<{ id: string }, { }>,
@@ -1300,6 +1307,7 @@ export type CustomActions = {
1300
1307
  enduserId?: string, // optional patient this conversation is about
1301
1308
  journeyId?: string, // optional journey that produced this conversation
1302
1309
  automationStepId?: string, // optional automation step that produced this conversation
1310
+ model?: string, // 'Claude Sonnet 5' (default) | 'Claude Opus 4.8'; must match the conversation's model when continuing
1303
1311
  }, { ai_conversation: AIConversation }>,
1304
1312
  generate_ai_decision: CustomAction<
1305
1313
  AIDecisionAutomationAction['info'] & { enduserId: string, automationStepId: string, journeyContext?: JourneyContext },
@@ -3648,7 +3656,17 @@ export const schema: SchemaV1 = build_schema({
3648
3656
 
3649
3657
  return "Only admin users can update requireSSO"
3650
3658
  }
3651
- },
3659
+ },
3660
+ {
3661
+ explanation: "Only admin users can update allowedMFAMethods",
3662
+ evaluate: ({ roles }, _, session, method, { updates }) => {
3663
+ if ((session as UserSession)?.roles?.includes('Admin')) return // admin can do this
3664
+ if (method === 'create') return // create already admin restricted
3665
+ if (!updates?.allowedMFAMethods) return // allowedMFAMethods not provided
3666
+
3667
+ return "Only admin users can update allowedMFAMethods"
3668
+ }
3669
+ },
3652
3670
  {
3653
3671
  explanation: "User organizationIds are readonly",
3654
3672
  evaluate: ({ }, _, session, method, { updates }) => {
@@ -3806,14 +3824,40 @@ export const schema: SchemaV1 = build_schema({
3806
3824
  name: 'Configure MFA',
3807
3825
  path: '/users/configure-mfa',
3808
3826
  description: "Configures MFA (or removes it, when allowed by an organization)",
3809
- parameters: {
3827
+ parameters: {
3810
3828
  disable: { validator: booleanValidator },
3829
+ method: { validator: exactMatchValidator<MFAMethod>(['email', 'authenticator']) },
3811
3830
  },
3812
- returns: {
3831
+ returns: {
3813
3832
  recoveryCodes: { validator: listOfStringsValidator, required: true },
3814
- authToken: { validator: stringValidator, required: true },
3815
- user: { validator: 'user' as any, required: true },
3816
- }
3833
+ authToken: { validator: stringValidator, required: true },
3834
+ user: { validator: 'user' as any, required: true },
3835
+ }
3836
+ },
3837
+ begin_TOTP_configuration: {
3838
+ op: "custom", access: 'update', method: "post",
3839
+ name: 'Begin TOTP Configuration',
3840
+ path: '/users/begin-totp-configuration',
3841
+ description: "Begins authenticator-app (TOTP) MFA enrollment, returning the otpauth URL and secret to display",
3842
+ parameters: { },
3843
+ returns: {
3844
+ otpauthURL: { validator: stringValidator, required: true },
3845
+ secret: { validator: stringValidator, required: true },
3846
+ }
3847
+ },
3848
+ confirm_TOTP_configuration: {
3849
+ op: "custom", access: 'update', method: "post",
3850
+ name: 'Confirm TOTP Configuration',
3851
+ path: '/users/confirm-totp-configuration',
3852
+ description: "Completes authenticator-app (TOTP) MFA enrollment by verifying a code from the authenticator app",
3853
+ parameters: {
3854
+ code: { validator: stringValidator100, required: true },
3855
+ },
3856
+ returns: {
3857
+ recoveryCodes: { validator: listOfStringsValidator, required: true },
3858
+ authToken: { validator: stringValidator, required: true },
3859
+ user: { validator: 'user' as any, required: true },
3860
+ }
3817
3861
  },
3818
3862
  generate_MFA_challenge: {
3819
3863
  op: "custom", access: 'update', method: "post",
@@ -4180,6 +4224,7 @@ export const schema: SchemaV1 = build_schema({
4180
4224
  dashboardView: { validator: customDashboardViewValidator },
4181
4225
  hideFromCalendarView: { validator: booleanValidator },
4182
4226
  requireSSO: { validator: listOfStringsValidatorUniqueOptionalOrEmptyOkay },
4227
+ allowedMFAMethods: { validator: listValidatorOptionalOrEmptyOk(exactMatchValidator<MFAMethod>(['email', 'authenticator'])) },
4183
4228
  linkedAccountAccess: { validator: linkedAccountAccessValidator },
4184
4229
  }
4185
4230
  },
@@ -5076,6 +5121,7 @@ export const schema: SchemaV1 = build_schema({
5076
5121
  },
5077
5122
  previousFields: { // can't be required - nextField may not exist yet on creation
5078
5123
  validator: previousFormFieldsValidator,
5124
+ initializer: () => [], // default to [] on create when client omits it, so previousFields is never persisted as undefined
5079
5125
  examples: [[{ type: 'root', info: { } } as PreviousFormField]]
5080
5126
  },
5081
5127
  flowchartUI: { validator: flowchartUIValidator },
@@ -6100,7 +6146,7 @@ export const schema: SchemaV1 = build_schema({
6100
6146
  canvasCoding: { validator: canvasCodingValidatorOptional },
6101
6147
  canvasReasonCoding: { validator: canvasCodingValidatorOptional },
6102
6148
  canvasLocationId: { validator: stringValidator100 },
6103
- references: { validator: listOfRelatedRecordsValidator, updatesDisabled: true },
6149
+ references: { validator: listOfRelatedRecordsValidator, enduserUpdatesDisabled: true },
6104
6150
  completedAt: { validator: dateValidatorOptional },
6105
6151
  completedBy: { validator: stringValidator },
6106
6152
  confirmedAt: { validator: dateValidatorOptional },
@@ -8149,9 +8195,20 @@ If a voicemail is left, it is indicated by recordingURI, transcription, or recor
8149
8195
  },
8150
8196
  returns: {},
8151
8197
  },
8198
+ cold_transfer: {
8199
+ op: "custom", access: 'update', method: "post",
8200
+ name: 'Cold Transfer',
8201
+ path: '/phone-calls/cold-transfer',
8202
+ description: "Cold transfers an active inbound call to another user, falling through to voicemail if unanswered",
8203
+ parameters: {
8204
+ callSid: { validator: stringValidator100, required: true },
8205
+ targetUserId: { validator: mongoIdStringValidator, required: true },
8206
+ },
8207
+ returns: {},
8208
+ },
8152
8209
  add_conference_attendees: {
8153
8210
  op: "custom", access: 'update', method: "post",
8154
- name: 'Remove Conference Attendees',
8211
+ name: 'Add Conference Attendees',
8155
8212
  path: '/phone-calls/add-conference-attendees',
8156
8213
  description: "Adds attendees to conference call",
8157
8214
  parameters: {
@@ -8251,6 +8308,10 @@ If a voicemail is left, it is indicated by recordingURI, transcription, or recor
8251
8308
  unread: { validator: booleanValidator },
8252
8309
 
8253
8310
  userId: { validator: mongoIdStringValidator },
8311
+ dialedUserIds: { validator: listOfListsOfMongoIdStringsValidatorOptionalOrEmptyOk, updatesDisabled: true },
8312
+ ignoredUserIds: { validator: listOfListsOfMongoIdStringsValidatorOptionalOrEmptyOk, updatesDisabled: true },
8313
+ lastDialedUserIds: { validator: listOfMongoIdStringValidatorOptionalOrEmptyOk, updatesDisabled: true },
8314
+ coldTransfers: { validator: coldTransfersValidator, updatesDisabled: true },
8254
8315
  ticketId: { validator: mongoIdStringValidator },
8255
8316
  pinnedAt: { validator: dateOptionalOrEmptyStringValidator },
8256
8317
  readBy: { validator: idStringToDateValidator },
@@ -10081,6 +10142,7 @@ If a voicemail is left, it is indicated by recordingURI, transcription, or recor
10081
10142
  enduserId: { validator: mongoIdStringValidator }, // optional patient this conversation is about
10082
10143
  journeyId: { validator: mongoIdStringValidator }, // optional journey that produced this conversation
10083
10144
  automationStepId: { validator: mongoIdStringValidator }, // optional automation step that produced this conversation
10145
+ model: { validator: selectableAIModelValidator }, // 'Claude Sonnet 5' (default) | 'Claude Opus 4.8'; must match the conversation's model when continuing
10084
10146
  },
10085
10147
  returns: {
10086
10148
  ai_conversation: { validator: 'ai_conversation' as any, required: true },
@@ -10107,7 +10169,7 @@ If a voicemail is left, it is indicated by recordingURI, transcription, or recor
10107
10169
  fields: {
10108
10170
  ...BuiltInFields,
10109
10171
  type: { validator: stringValidator, required: true, examples: ['HTML Template Generation'] },
10110
- modelName: { validator: stringValidator, required: true, examples: ['Claude Sonnet 4', 'Claude Sonnet 4.5', 'Claude Sonnet 4.6'] },
10172
+ modelName: { validator: stringValidator, required: true, examples: ['Claude Sonnet 4', 'Claude Sonnet 4.5', 'Claude Sonnet 4.6', 'Claude Sonnet 5', 'Claude Opus 4.8'] },
10111
10173
  orchestrationId: { validator: stringValidatorOptional, examples: ['workflow-123', 'batch-456'] },
10112
10174
  enduserId: {
10113
10175
  validator: mongoIdStringOptional,