@tellescope/schema 1.2.5 → 1.3.3
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/schema.d.ts +40 -2
- package/lib/cjs/schema.d.ts.map +1 -1
- package/lib/cjs/schema.js +100 -16
- package/lib/cjs/schema.js.map +1 -1
- package/lib/esm/schema.d.ts +40 -2
- package/lib/esm/schema.d.ts.map +1 -1
- package/lib/esm/schema.js +101 -17
- package/lib/esm/schema.js.map +1 -1
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/package.json +7 -7
- package/src/schema.ts +131 -15
package/src/schema.ts
CHANGED
|
@@ -4,6 +4,7 @@ import {
|
|
|
4
4
|
DatabaseRecord,
|
|
5
5
|
ObjectId,
|
|
6
6
|
ModelName,
|
|
7
|
+
User,
|
|
7
8
|
} from "@tellescope/types-server"
|
|
8
9
|
import {
|
|
9
10
|
ErrorInfo,
|
|
@@ -37,6 +38,9 @@ import {
|
|
|
37
38
|
Enduser,
|
|
38
39
|
Journey,
|
|
39
40
|
FormResponse,
|
|
41
|
+
FormField,
|
|
42
|
+
Form,
|
|
43
|
+
Meeting,
|
|
40
44
|
} from "@tellescope/types-client"
|
|
41
45
|
|
|
42
46
|
import {
|
|
@@ -106,6 +110,9 @@ import {
|
|
|
106
110
|
previousFormFieldsValidator,
|
|
107
111
|
numberValidator,
|
|
108
112
|
organizationThemeValidator,
|
|
113
|
+
managedContentRecordTypeValidator,
|
|
114
|
+
passwordValidator,
|
|
115
|
+
flowchartUIValidator,
|
|
109
116
|
} from "@tellescope/validation"
|
|
110
117
|
|
|
111
118
|
import {
|
|
@@ -313,6 +320,11 @@ export type CustomActions = {
|
|
|
313
320
|
form_responses: {
|
|
314
321
|
prepare_form_response: CustomAction<{ formId: string, enduserId: string, automationStepId?: string }, { accessCode: string, url: string }>,
|
|
315
322
|
submit_form_response: CustomAction<{ accessCode: string, responses: FormResponseValue[], automationStepId?: string }, { formResponse: FormResponse }>,
|
|
323
|
+
info_for_access_code: CustomAction<{ accessCode: string }, {
|
|
324
|
+
form: Form,
|
|
325
|
+
fields: FormField[],
|
|
326
|
+
response: FormResponse,
|
|
327
|
+
}>,
|
|
316
328
|
},
|
|
317
329
|
journeys: {
|
|
318
330
|
update_state: CustomAction<{ updates: Partial<JourneyState>, id: string, name: string }, { updated: Journey }>,
|
|
@@ -332,10 +344,16 @@ export type CustomActions = {
|
|
|
332
344
|
users: {
|
|
333
345
|
display_info: CustomAction<{ }, { fname: string, lname: string, id: string }[]>,
|
|
334
346
|
refresh_session: CustomAction<{}, { user: UserSession, authToken: string }>,
|
|
347
|
+
generate_auth_token: CustomAction<{ id?: string, phone?: string, email?: string, externalId?: string, durationInSeconds?: number }, {
|
|
348
|
+
authToken: string,
|
|
349
|
+
enduser?: Enduser,
|
|
350
|
+
user?: User,
|
|
351
|
+
}>,
|
|
335
352
|
},
|
|
336
353
|
chat_rooms: {
|
|
337
354
|
join_room: CustomAction<{ id: string }, { room: ChatRoom }>,
|
|
338
355
|
display_info: CustomAction<{ id: string }, { id: string, display_info: { [index: string]: UserDisplayInfo } }>,
|
|
356
|
+
mark_read: CustomAction<{ id: string }, { updated: ChatRoom }>,
|
|
339
357
|
},
|
|
340
358
|
meetings: {
|
|
341
359
|
start_meeting: CustomAction<{ attendees?: UserIdentity[], publicRead?: boolean }, { id: string, meeting: { Meeting: MeetingInfo }, host: Attendee }>,
|
|
@@ -344,8 +362,9 @@ export type CustomActions = {
|
|
|
344
362
|
add_attendees_to_meeting: CustomAction<{ id: string, attendees: UserIdentity[] }, { }>,
|
|
345
363
|
my_meetings: CustomAction<{}, { id: string, updatedAt: string, status: MeetingStatus }[]>
|
|
346
364
|
attendee_info: CustomAction<{ id: string }, { attendee: Attendee, others: UserIdentity[] }>,
|
|
347
|
-
start_meeting_for_event: CustomAction<{ calendarEventId: string }, { meeting: { Meeting: MeetingInfo }, host: Attendee }>,
|
|
365
|
+
start_meeting_for_event: CustomAction<{ calendarEventId: string }, { id: string, meeting: { Meeting: MeetingInfo }, host: Attendee }>,
|
|
348
366
|
join_meeting_for_event: CustomAction<{ calendarEventId: string }, { meeting: { Meeting: MeetingInfo } }>,
|
|
367
|
+
read: CustomAction<{ id: string }, Meeting>,
|
|
349
368
|
},
|
|
350
369
|
webhooks: {
|
|
351
370
|
configure: CustomAction<{ url: string, secret: string, subscriptions?: WebhookSubscriptionsType }, { }>,
|
|
@@ -369,7 +388,12 @@ export type PublicActions = {
|
|
|
369
388
|
{ id?: string, email?: string, phone?: string, password: string, durationInSeconds: number },
|
|
370
389
|
{ authToken: string }
|
|
371
390
|
>,
|
|
372
|
-
register: CustomAction<{
|
|
391
|
+
register: CustomAction<{
|
|
392
|
+
emailConsent?: boolean, fname?: string, lname?: string, email: string, password: string,
|
|
393
|
+
termsVersion?: string, termsSigned?: Date,
|
|
394
|
+
}, { }>,
|
|
395
|
+
request_password_reset: CustomAction<{ email: string, businessId: string }, { }>,
|
|
396
|
+
reset_password: CustomAction<{ resetToken: string, newPassword: string, businessId: string }, { }>,
|
|
373
397
|
},
|
|
374
398
|
users: {
|
|
375
399
|
request_password_reset: CustomAction<{ email: string }, { }>,
|
|
@@ -523,9 +547,9 @@ export const schema: SchemaV1 = build_schema({
|
|
|
523
547
|
lastActive: {
|
|
524
548
|
validator: dateValidator,
|
|
525
549
|
},
|
|
526
|
-
lastLogout: {
|
|
527
|
-
|
|
528
|
-
},
|
|
550
|
+
lastLogout: { validator: dateValidator },
|
|
551
|
+
termsSigned: { validator: dateValidator },
|
|
552
|
+
termsVersion: { validator: stringValidator100 },
|
|
529
553
|
lastCommunication: {
|
|
530
554
|
redactions: ['enduser'],
|
|
531
555
|
validator: dateValidator,
|
|
@@ -642,15 +666,39 @@ export const schema: SchemaV1 = build_schema({
|
|
|
642
666
|
path: '/register-as-enduser',
|
|
643
667
|
description: "Allows and enduser to register directly with an email and password",
|
|
644
668
|
parameters: {
|
|
669
|
+
email: { validator: emailValidator, required: true },
|
|
670
|
+
password: { validator: stringValidator100, required: true },
|
|
645
671
|
fname: { validator: nameValidator },
|
|
646
672
|
lname: { validator: nameValidator },
|
|
647
673
|
emailConsent: { validator: booleanValidator },
|
|
648
|
-
|
|
649
|
-
|
|
674
|
+
termsSigned: { validator: dateValidator },
|
|
675
|
+
termsVersion: { validator: stringValidator100 },
|
|
650
676
|
},
|
|
651
677
|
returns: { } //authToken: { validator: stringValidator5000 } },
|
|
652
|
-
|
|
653
678
|
},
|
|
679
|
+
request_password_reset: {
|
|
680
|
+
op: "custom", access: 'update', method: "post",
|
|
681
|
+
name: 'Request Password Reset',
|
|
682
|
+
path: '/request-enduser-password-reset',
|
|
683
|
+
description: "Sends a password reset email",
|
|
684
|
+
parameters: {
|
|
685
|
+
email: { validator: emailValidator, required: true },
|
|
686
|
+
businessId: { validator: mongoIdStringValidator, required: true },
|
|
687
|
+
},
|
|
688
|
+
returns: { },
|
|
689
|
+
},
|
|
690
|
+
reset_password: {
|
|
691
|
+
op: "custom", access: 'update', method: "post",
|
|
692
|
+
name: 'Reset Password',
|
|
693
|
+
path: '/reset-enduser-password',
|
|
694
|
+
description: "For a code generated by request-enduser-password-reset, sets a new password",
|
|
695
|
+
parameters: {
|
|
696
|
+
resetToken: { validator: stringValidator250, required: true },
|
|
697
|
+
newPassword: { validator: passwordValidator, required: true },
|
|
698
|
+
businessId: { validator: mongoIdStringValidator, required: true },
|
|
699
|
+
},
|
|
700
|
+
returns: { },
|
|
701
|
+
},
|
|
654
702
|
},
|
|
655
703
|
},
|
|
656
704
|
enduser_status_updates: {
|
|
@@ -1171,7 +1219,7 @@ export const schema: SchemaV1 = build_schema({
|
|
|
1171
1219
|
}
|
|
1172
1220
|
},
|
|
1173
1221
|
defaultActions: DEFAULT_OPERATIONS,
|
|
1174
|
-
enduserActions: { create: {}, read: {}, readMany: {}, display_info: {} },
|
|
1222
|
+
enduserActions: { create: {}, read: {}, readMany: {}, display_info: {}, mark_read: {} },
|
|
1175
1223
|
customActions: {
|
|
1176
1224
|
join_room: {
|
|
1177
1225
|
op: "custom", access: 'update', method: "post",
|
|
@@ -1183,6 +1231,16 @@ export const schema: SchemaV1 = build_schema({
|
|
|
1183
1231
|
room: { validator: 'Room' },
|
|
1184
1232
|
} as any // add room eventually, when validator defined
|
|
1185
1233
|
},
|
|
1234
|
+
mark_read: {
|
|
1235
|
+
op: "custom", access: 'update', method: "post",
|
|
1236
|
+
name: 'Mark Read',
|
|
1237
|
+
path: '/mark-chat-room-read',
|
|
1238
|
+
description: "Marks the conversation read by the authenticated user",
|
|
1239
|
+
parameters: { id: { validator: mongoIdStringValidator, required: true } },
|
|
1240
|
+
returns: {
|
|
1241
|
+
updated: { validator: 'Room' },
|
|
1242
|
+
} as any // add room eventually, when validator defined
|
|
1243
|
+
},
|
|
1186
1244
|
display_info: {
|
|
1187
1245
|
op: "custom", access: 'read', method: "get",
|
|
1188
1246
|
name: 'Attendee display info',
|
|
@@ -1285,9 +1343,30 @@ export const schema: SchemaV1 = build_schema({
|
|
|
1285
1343
|
}
|
|
1286
1344
|
}],
|
|
1287
1345
|
},
|
|
1288
|
-
defaultActions: {
|
|
1346
|
+
defaultActions: {
|
|
1347
|
+
create: { adminOnly: true },
|
|
1348
|
+
read: {}, readMany: {}, update: { description: "Users can only be updated by self or an organization admin"}
|
|
1349
|
+
},
|
|
1289
1350
|
enduserActions: { display_info: {}, read: {}, readMany: {} },
|
|
1290
1351
|
customActions: {
|
|
1352
|
+
generate_auth_token: {
|
|
1353
|
+
op: "custom", access: 'create', method: "get",
|
|
1354
|
+
name: 'Generate authToken (Admin Only)',
|
|
1355
|
+
path: '/generate-auth-token',
|
|
1356
|
+
description: "Generates an authToken for a user or enduser. Useful for integrating a 3rd-party authentication process.",
|
|
1357
|
+
parameters: {
|
|
1358
|
+
id: { validator: mongoIdStringValidator },
|
|
1359
|
+
externalId: { validator: stringValidator250 },
|
|
1360
|
+
email: { validator: emailValidator },
|
|
1361
|
+
phone: { validator: phoneValidator },
|
|
1362
|
+
durationInSeconds: { validator: nonNegNumberValidator },
|
|
1363
|
+
},
|
|
1364
|
+
returns: {
|
|
1365
|
+
authToken: { validator: stringValidator100, required: true },
|
|
1366
|
+
enduser: { validator: 'enduser' as any, required: false },
|
|
1367
|
+
user: { validator: 'user' as any, required: false },
|
|
1368
|
+
},
|
|
1369
|
+
},
|
|
1291
1370
|
display_info: {
|
|
1292
1371
|
op: "custom", access: 'read', method: "get",
|
|
1293
1372
|
name: 'User Display Info',
|
|
@@ -1328,7 +1407,7 @@ export const schema: SchemaV1 = build_schema({
|
|
|
1328
1407
|
description: "For a code generated by request-password-reset, sets a new password",
|
|
1329
1408
|
parameters: {
|
|
1330
1409
|
resetToken: { validator: stringValidator250, required: true },
|
|
1331
|
-
newPassword: { validator:
|
|
1410
|
+
newPassword: { validator: passwordValidator, required: true },
|
|
1332
1411
|
},
|
|
1333
1412
|
returns: { },
|
|
1334
1413
|
},
|
|
@@ -1601,6 +1680,9 @@ export const schema: SchemaV1 = build_schema({
|
|
|
1601
1680
|
constraints: {
|
|
1602
1681
|
unique: [],
|
|
1603
1682
|
relationship: [],
|
|
1683
|
+
access: [
|
|
1684
|
+
{ type: 'filter', field: 'attendees.id' },
|
|
1685
|
+
]
|
|
1604
1686
|
},
|
|
1605
1687
|
defaultActions: {
|
|
1606
1688
|
readMany: {
|
|
@@ -1608,7 +1690,16 @@ export const schema: SchemaV1 = build_schema({
|
|
|
1608
1690
|
adminOnly: true,
|
|
1609
1691
|
}
|
|
1610
1692
|
},
|
|
1693
|
+
enduserActions: { my_meetings: {}, join_meeting_for_event: {}, read: {} },
|
|
1611
1694
|
customActions: {
|
|
1695
|
+
read: {
|
|
1696
|
+
op: "read", access: 'read', method: "get",
|
|
1697
|
+
description: "Get a meeting",
|
|
1698
|
+
parameters: {
|
|
1699
|
+
id: { validator: mongoIdStringValidator },
|
|
1700
|
+
},
|
|
1701
|
+
returns: 'meeting' as any,
|
|
1702
|
+
},
|
|
1612
1703
|
start_meeting: {
|
|
1613
1704
|
op: "custom", access: 'create', method: "post",
|
|
1614
1705
|
name: 'Start Meeting',
|
|
@@ -1704,7 +1795,6 @@ export const schema: SchemaV1 = build_schema({
|
|
|
1704
1795
|
},
|
|
1705
1796
|
},
|
|
1706
1797
|
},
|
|
1707
|
-
enduserActions: { my_meetings: {}, join_meeting_for_event: {} },
|
|
1708
1798
|
fields: {
|
|
1709
1799
|
...BuiltInFields,
|
|
1710
1800
|
// all fields are updatable by custom endpoints only
|
|
@@ -1835,6 +1925,7 @@ export const schema: SchemaV1 = build_schema({
|
|
|
1835
1925
|
validator: previousFormFieldsValidator,
|
|
1836
1926
|
examples: [[{ type: 'root', info: { } } as PreviousFormField]]
|
|
1837
1927
|
},
|
|
1928
|
+
flowchartUI: { validator: flowchartUIValidator },
|
|
1838
1929
|
options: { validator: objectAnyFieldsAnyValuesValidator }, // todo: more restriction
|
|
1839
1930
|
description: { validator: stringValidator250 },
|
|
1840
1931
|
intakeField: { validator: stringValidator }, // todo: ensure built-ins are ignored
|
|
@@ -1884,6 +1975,7 @@ export const schema: SchemaV1 = build_schema({
|
|
|
1884
1975
|
responses: { validator: formResponsesValidator },
|
|
1885
1976
|
},
|
|
1886
1977
|
defaultActions: DEFAULT_OPERATIONS,
|
|
1978
|
+
enduserActions: { prepare_form_response: {}, info_for_access_code: {}, submit_form_response: {}, read: {}, readMany: {} },
|
|
1887
1979
|
customActions: {
|
|
1888
1980
|
prepare_form_response: {
|
|
1889
1981
|
op: "custom", access: 'create', method: "post",
|
|
@@ -1913,7 +2005,21 @@ export const schema: SchemaV1 = build_schema({
|
|
|
1913
2005
|
returns: {
|
|
1914
2006
|
formResponse: 'form response' as any,
|
|
1915
2007
|
},
|
|
1916
|
-
}
|
|
2008
|
+
},
|
|
2009
|
+
info_for_access_code: {
|
|
2010
|
+
op: "custom", access: 'read', method: "get",
|
|
2011
|
+
name: 'Info for Access Code',
|
|
2012
|
+
path: '/form-info-for-access-code',
|
|
2013
|
+
description: "With an accessCode, retrieves the relevant info for submitting a form",
|
|
2014
|
+
parameters: {
|
|
2015
|
+
accessCode: { validator: stringValidator250, required: true },
|
|
2016
|
+
},
|
|
2017
|
+
returns: {
|
|
2018
|
+
form: 'form' as any,
|
|
2019
|
+
fields: 'form fields' as any,
|
|
2020
|
+
response: 'form response' as any,
|
|
2021
|
+
},
|
|
2022
|
+
},
|
|
1917
2023
|
},
|
|
1918
2024
|
publicActions: {
|
|
1919
2025
|
session_for_public_form: {
|
|
@@ -1937,7 +2043,6 @@ export const schema: SchemaV1 = build_schema({
|
|
|
1937
2043
|
},
|
|
1938
2044
|
},
|
|
1939
2045
|
},
|
|
1940
|
-
enduserActions: { prepare_form_response: {}, submit_form_response: {}, read: {}, readMany: {} },
|
|
1941
2046
|
},
|
|
1942
2047
|
webhooks: {
|
|
1943
2048
|
info: {
|
|
@@ -2104,6 +2209,7 @@ export const schema: SchemaV1 = build_schema({
|
|
|
2104
2209
|
},
|
|
2105
2210
|
description: { validator: stringValidator5000 },
|
|
2106
2211
|
meetingId: { validator: mongoIdStringValidator, readonly: true },
|
|
2212
|
+
meetingStatus: { validator: meetingStatusValidator },
|
|
2107
2213
|
chatRoomId: {
|
|
2108
2214
|
validator: mongoIdStringValidator,
|
|
2109
2215
|
dependencies: [{
|
|
@@ -2215,7 +2321,8 @@ export const schema: SchemaV1 = build_schema({
|
|
|
2215
2321
|
},
|
|
2216
2322
|
}]
|
|
2217
2323
|
},
|
|
2218
|
-
conditions: { validator: listOfAutomationConditionsValidator }
|
|
2324
|
+
conditions: { validator: listOfAutomationConditionsValidator },
|
|
2325
|
+
flowchartUI: { validator: flowchartUIValidator },
|
|
2219
2326
|
}
|
|
2220
2327
|
},
|
|
2221
2328
|
automated_actions: {
|
|
@@ -2465,6 +2572,14 @@ export const schema: SchemaV1 = build_schema({
|
|
|
2465
2572
|
validator: stringValidator25000,
|
|
2466
2573
|
examples: ["This is the template message......"],
|
|
2467
2574
|
},
|
|
2575
|
+
type: {
|
|
2576
|
+
validator: managedContentRecordTypeValidator,
|
|
2577
|
+
updatesDisabled: true,
|
|
2578
|
+
},
|
|
2579
|
+
attachments: {
|
|
2580
|
+
validator: listOfChatAttachmentsValidator,
|
|
2581
|
+
},
|
|
2582
|
+
headerPhoto: { validator: stringValidator250 },
|
|
2468
2583
|
publicRead: { validator: booleanValidator },
|
|
2469
2584
|
mode: { validator: messageTemplateModeValidator, },
|
|
2470
2585
|
files: { validator: listOfStringsValidator },
|
|
@@ -2744,6 +2859,7 @@ export const schema: SchemaV1 = build_schema({
|
|
|
2744
2859
|
roles: { validator: listOfStringsValidator },
|
|
2745
2860
|
skills: { validator: listOfStringsValidator },
|
|
2746
2861
|
themeColor: { validator: stringValidator100 },
|
|
2862
|
+
customPortalURL: { validator: stringValidator250 },
|
|
2747
2863
|
},
|
|
2748
2864
|
},
|
|
2749
2865
|
|