@tellescope/schema 0.0.12 → 0.0.16

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tellescope/schema",
3
- "version": "0.0.12",
3
+ "version": "0.0.16",
4
4
  "description": "Schema definition for Tellescope models",
5
5
  "main": "./lib/cjs/schema.js",
6
6
  "module": "./lib/esm/schema.js",
@@ -23,11 +23,11 @@
23
23
  },
24
24
  "homepage": "https://github.com/tellescope-os/tellescope#readme",
25
25
  "dependencies": {
26
- "@tellescope/constants": "^0.0.12",
27
- "@tellescope/types-models": "^0.0.12",
28
- "@tellescope/types-server": "^0.0.12",
29
- "@tellescope/types-utilities": "^0.0.12",
30
- "@tellescope/validation": "^0.0.12",
26
+ "@tellescope/constants": "^0.0.16",
27
+ "@tellescope/types-models": "^0.0.16",
28
+ "@tellescope/types-server": "^0.0.16",
29
+ "@tellescope/types-utilities": "^0.0.16",
30
+ "@tellescope/validation": "^0.0.16",
31
31
  "validator": "^13.1.17"
32
32
  },
33
33
  "devDependencies": {
@@ -42,5 +42,5 @@
42
42
  "publishConfig": {
43
43
  "access": "public"
44
44
  },
45
- "gitHead": "5d67de4721a3cbc3537a870281f2c657099e07b4"
45
+ "gitHead": "06e581f4d3a6c5b57fd0cfcc22103b94125f9da4"
46
46
  }
package/src/schema.ts CHANGED
@@ -18,7 +18,7 @@ import {
18
18
  } from "@tellescope/types-utilities"
19
19
  import {
20
20
  EnduserSession,
21
- ConfiguredSession,
21
+ ChatRoom,
22
22
  JourneyState,
23
23
  UserSession,
24
24
  AttendeeInfo,
@@ -257,12 +257,16 @@ export type CustomActions = {
257
257
  { isAuthenticated: true, enduser: Enduser } | { isAuthenticated: false, enduser: null }
258
258
  >,
259
259
  refresh_session: CustomAction<{}, { enduser: Enduser, authToken: string }>,
260
+ generate_auth_token: CustomAction<{ id?: string, phone?: string, email?: string, externalId?: string }, { authToken: string, enduser: Enduser }>,
260
261
  logout: CustomAction<{ }, { }>,
261
262
  },
262
263
  users: {
263
- display_names: CustomAction<{ }, { fname: string, lname: string, id: string }[]>,
264
+ display_info: CustomAction<{ }, { fname: string, lname: string, id: string }[]>,
264
265
  refresh_session: CustomAction<{}, { user: UserSession, authToken: string }>,
265
266
  },
267
+ chat_rooms: {
268
+ join_room: CustomAction<{ id: string }, { room: ChatRoom }>,
269
+ },
266
270
  meetings: {
267
271
  start_meeting: CustomAction<{ }, { id: string, meeting: object, host: AttendeeInfo }>,
268
272
  end_meeting: CustomAction<{ id: string }, { }>,
@@ -344,6 +348,9 @@ export const schema: SchemaV1 = {
344
348
  lname: {
345
349
  validator: nameValidator,
346
350
  },
351
+ dateOfBirth: {
352
+ validator: dateValidator,
353
+ },
347
354
  journeys: {
348
355
  validator: journeysValidator,
349
356
  dependencies: [
@@ -428,9 +435,25 @@ export const schema: SchemaV1 = {
428
435
  enduserOnly: true,
429
436
  returns: {
430
437
  authToken: { validator: stringValidator, required: true },
431
- enduser: { validator: 'enduser' },
438
+ enduser: { validator: 'enduser', required: true },
432
439
  } as any // todo: add enduser eventually, when validator defined
433
440
  },
441
+ generate_auth_token: {
442
+ op: "custom", access: 'create', method: "get",
443
+ name: 'Generate authToken',
444
+ path: '/generate-enduser-auth-token',
445
+ description: "Generates an authToken for use by an enduser. Useful for integrating a 3rd-party authentication process or creating a session for an enduser without a set password in Tellescope.",
446
+ parameters: {
447
+ id: { validator: mongoIdStringValidator },
448
+ externalId: { validator: stringValidator250 },
449
+ email: { validator: emailValidator },
450
+ phone: { validator: phoneValidator },
451
+ },
452
+ returns: {
453
+ authToken: { validator: stringValidator100, required: true },
454
+ enduser: { validator: 'enduser' as any, required: true },
455
+ },
456
+ },
434
457
  logout: {
435
458
  op: "custom", access: 'update', method: "post",
436
459
  name: 'Logout enduser',
@@ -853,8 +876,8 @@ export const schema: SchemaV1 = {
853
876
  },
854
877
  userIds: {
855
878
  validator: listOfMongoIdStringValidator,
856
- required: true,
857
879
  examples: [[PLACEHOLDER_ID]],
880
+ // required: true, // no longer required
858
881
  // add pull dependency for user deletion?
859
882
  },
860
883
  enduserIds: {
@@ -877,10 +900,24 @@ export const schema: SchemaV1 = {
877
900
  endedAt: {
878
901
  validator: dateValidator,
879
902
  },
903
+ tags: {
904
+ validator: listOfStringsValidator,
905
+ },
880
906
  },
881
907
  defaultActions: DEFAULT_OPERATIONS,
882
908
  enduserActions: { create: {}, read: {}, readMany: {} },
883
- customActions: {},
909
+ customActions: {
910
+ join_room: {
911
+ op: "custom", access: 'update', method: "post",
912
+ name: 'Join chat room',
913
+ path: '/join-chat-room',
914
+ description: "Allows a user to join a chat room with no other users, for use in accepting support chats.",
915
+ parameters: { id: { validator: mongoIdStringValidator, required: true } },
916
+ returns: {
917
+ room: { validator: 'Room' },
918
+ } as any // add room eventually, when validator defined
919
+ },
920
+ },
884
921
  },
885
922
  chats: {
886
923
  info: {
@@ -916,7 +953,7 @@ export const schema: SchemaV1 = {
916
953
  senderId: {
917
954
  validator: mongoIdStringValidator,
918
955
  readonly: true, // create a separate endpoint for storing enduser chats
919
- initializer: (a, s) => (s as UserSession).id ?? (s as EnduserSession).id,
956
+ initializer: (a, s) => s.id,
920
957
  examples: [PLACEHOLDER_ID],
921
958
  dependencies: [{ // can be userId or enduserId
922
959
  dependsOn: ['users', 'endusers'],
@@ -954,11 +991,11 @@ export const schema: SchemaV1 = {
954
991
  },
955
992
  defaultActions: { read: {}, readMany: {} },
956
993
  customActions: {
957
- display_names: {
994
+ display_info: {
958
995
  op: "custom", access: 'read', method: "get",
959
- name: 'User Display Names',
960
- path: '/user-display-names',
961
- description: "Gets display names for users, accessible by endusers",
996
+ name: 'User Display Info',
997
+ path: '/user-display-info',
998
+ description: "Gets display info for users, accessible by endusers",
962
999
  parameters: {},
963
1000
  returns: {
964
1001
  validator: listOfDisplayNameInfo
@@ -975,7 +1012,6 @@ export const schema: SchemaV1 = {
975
1012
  enduser: { validator: 'user' },
976
1013
  } as any // add enduser eventually, when validator defined
977
1014
  },
978
-
979
1015
  },
980
1016
  enduserActions: { display_names: {} },
981
1017
  fields: {
@@ -1075,6 +1111,9 @@ export const schema: SchemaV1 = {
1075
1111
  validator: fileTypeValidator,
1076
1112
  required: true
1077
1113
  },
1114
+ enduserId: {
1115
+ validator: mongoIdStringValidator,
1116
+ },
1078
1117
  secureName: {
1079
1118
  validator: stringValidator250,
1080
1119
  readonly: true,
@@ -1113,7 +1152,7 @@ export const schema: SchemaV1 = {
1113
1152
  file_download_URL: {
1114
1153
  op: "custom", access: 'read', method: "get",
1115
1154
  name: 'Generate File Download',
1116
- path: '/file-download-link',
1155
+ path: '/file-download-URL',
1117
1156
  description: "Generates a temporary download link for a file.",
1118
1157
  parameters: {
1119
1158
  secureName: { validator: stringValidator250 },
@@ -1153,6 +1192,9 @@ export const schema: SchemaV1 = {
1153
1192
  required: true,
1154
1193
  examples: [PLACEHOLDER_ID],
1155
1194
  },
1195
+ chatRoomId: {
1196
+ validator: mongoIdStringValidator,
1197
+ },
1156
1198
  closedAt: {
1157
1199
  validator: dateValidator,
1158
1200
  },
@@ -1202,7 +1244,7 @@ export const schema: SchemaV1 = {
1202
1244
  name: "End Meeting",
1203
1245
  path: '/end-meeting',
1204
1246
  description: "Ends a video meeting",
1205
- parameters: { id: { validator: mongoIdStringValidator } },
1247
+ parameters: { id: { validator: mongoIdStringValidator, required: true } },
1206
1248
  returns: { },
1207
1249
  },
1208
1250
  add_attendees_to_meeting: {
@@ -1211,8 +1253,8 @@ export const schema: SchemaV1 = {
1211
1253
  path: '/add-attendees-to-meeting',
1212
1254
  description: "Adds other attendees to a meeting",
1213
1255
  parameters: {
1214
- id: { validator: mongoIdStringValidator },
1215
- attendees: { validator: listOfUserIndentitiesValidator },
1256
+ id: { validator: mongoIdStringValidator, required: true },
1257
+ attendees: { validator: listOfUserIndentitiesValidator, required: true },
1216
1258
  },
1217
1259
  returns: { },
1218
1260
  },
@@ -1222,11 +1264,11 @@ export const schema: SchemaV1 = {
1222
1264
  path: '/attendee-info',
1223
1265
  description: "Gets meeting info for the current user, and details about other attendees",
1224
1266
  parameters: {
1225
- id: { validator: mongoIdStringValidator },
1267
+ id: { validator: mongoIdStringValidator, required: true },
1226
1268
  },
1227
1269
  returns: {
1228
- attendee: { validator: attendeeInfoValidator },
1229
- others: { validator: listOfUserIndentitiesValidator },
1270
+ attendee: { validator: attendeeInfoValidator, required: true },
1271
+ others: { validator: listOfUserIndentitiesValidator, required: true },
1230
1272
  },
1231
1273
  },
1232
1274
  my_meetings: {
@@ -1234,10 +1276,8 @@ export const schema: SchemaV1 = {
1234
1276
  name: 'Get list of meetings',
1235
1277
  path: '/my-meetings',
1236
1278
  description: "Gets meetings for the current user.",
1237
- parameters: {
1238
- id: { validator: mongoIdStringValidator },
1239
- },
1240
- returns: { validator: meetingsListValidator },
1279
+ parameters: {},
1280
+ returns: { validator: meetingsListValidator, required: true },
1241
1281
  }
1242
1282
  },
1243
1283
  enduserActions: { my_meetings: {} },
@@ -1259,4 +1299,36 @@ export const schema: SchemaV1 = {
1259
1299
  }
1260
1300
  }
1261
1301
  },
1302
+ notes: {
1303
+ info: {},
1304
+ constraints: {
1305
+ unique: [],
1306
+ relationship: [],
1307
+ },
1308
+ defaultActions: DEFAULT_OPERATIONS,
1309
+ customActions: {},
1310
+ enduserActions: {},
1311
+ fields: {
1312
+ ...BuiltInFields,
1313
+ enduserId: {
1314
+ validator: mongoIdStringValidator,
1315
+ required: true,
1316
+ examples: [PLACEHOLDER_ID],
1317
+ },
1318
+ ticketId: {
1319
+ validator: mongoIdStringValidator,
1320
+ },
1321
+ text: {
1322
+ validator: stringValidator5000,
1323
+ examples: ["Text"],
1324
+ },
1325
+ title: {
1326
+ validator: stringValidator250,
1327
+ examples: ["Text"],
1328
+ },
1329
+ fields: {
1330
+ validator: fieldsValidator,
1331
+ }
1332
+ }
1333
+ },
1262
1334
  }