@tellescope/schema 1.0.0 → 1.1.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/src/schema.ts CHANGED
@@ -98,6 +98,9 @@ import {
98
98
  listOfRelatedRecordsValidator,
99
99
  cancelConditionsValidator,
100
100
  notificationPreferencesValidator,
101
+ FHIRObservationCategoryValidator,
102
+ FHIRObservationStatusCodeValidator,
103
+ FHIRObservationValueValidator,
101
104
  } from "@tellescope/validation"
102
105
 
103
106
  import {
@@ -247,7 +250,11 @@ const sideEffects = {
247
250
  updateEnduserStatus: {
248
251
  name: "updateEnduserStatus",
249
252
  description: "Updates the journeys[journeyId] field in an enduser to reflect a new status update"
250
- }
253
+ },
254
+ updatePostCommentCount: {
255
+ name: "updatePostCommentCount",
256
+ description: "Updates the comment count of a post"
257
+ },
251
258
  }
252
259
  export type SideEffectNames = keyof typeof sideEffects
253
260
 
@@ -309,7 +316,7 @@ export type CustomActions = {
309
316
  display_info: CustomAction<{ id: string }, { id: string, display_info: { [index: string]: UserDisplayInfo } }>,
310
317
  },
311
318
  meetings: {
312
- start_meeting: CustomAction<{ attendees?: UserIdentity[] }, { id: string, meeting: { Meeting: MeetingInfo }, host: Attendee }>,
319
+ start_meeting: CustomAction<{ attendees?: UserIdentity[], publicRead?: boolean }, { id: string, meeting: { Meeting: MeetingInfo }, host: Attendee }>,
313
320
  send_invite: CustomAction<{ meetingId: string, enduserId: string }, { }>,
314
321
  end_meeting: CustomAction<{ id: string }, { }>,
315
322
  add_attendees_to_meeting: CustomAction<{ id: string, attendees: UserIdentity[] }, { }>,
@@ -325,6 +332,10 @@ export type CustomActions = {
325
332
  },
326
333
  user_notifications: {
327
334
  send_user_email_notification: CustomAction<{ userId: string, message: string, subject?: string }, { }>,
335
+ },
336
+ post_likes: {
337
+ create: CustomAction<{ postId: string, forumId: string }, { }>,
338
+ unlike_post: CustomAction<{ postId: string, forumId: string }, { }>,
328
339
  }
329
340
  }
330
341
 
@@ -1530,6 +1541,7 @@ export const schema: SchemaV1 = build_schema({
1530
1541
  description: "Generates an video meeting room",
1531
1542
  parameters: {
1532
1543
  attendees: { validator: listOfUserIndentitiesValidator },
1544
+ publicRead: { validator: booleanValidator },
1533
1545
  },
1534
1546
  returns: {
1535
1547
  id: { validator: mongoIdStringValidator, required: true },
@@ -1606,6 +1618,7 @@ export const schema: SchemaV1 = build_schema({
1606
1618
  validator: meetingInfoValidator,
1607
1619
  readonly: true
1608
1620
  },
1621
+ publicRead: { validator: booleanValidator },
1609
1622
  endedAt: { validator: dateValidator },
1610
1623
  }
1611
1624
  },
@@ -1914,6 +1927,8 @@ export const schema: SchemaV1 = build_schema({
1914
1927
  validator: listOfCalendarEventRemindersValidator,
1915
1928
  initializer: () => [],
1916
1929
  },
1930
+ publicRead: { validator: booleanValidator },
1931
+ displayImage: { validator: stringValidator },
1917
1932
  fields: { validator: fieldsValidator },
1918
1933
  }
1919
1934
  },
@@ -2174,6 +2189,293 @@ export const schema: SchemaV1 = build_schema({
2174
2189
  relatedRecords: { validator: listOfRelatedRecordsValidator },
2175
2190
  }
2176
2191
  },
2192
+ enduser_observations: {
2193
+ info: {},
2194
+ constraints: {
2195
+ unique: [],
2196
+ relationship: [],
2197
+ },
2198
+ defaultActions: DEFAULT_OPERATIONS,
2199
+ customActions: { },
2200
+ enduserActions: { create: {}, createMany: {}, read: {}, readMany: {} },
2201
+ fields: {
2202
+ ...BuiltInFields,
2203
+ category: {
2204
+ required: true,
2205
+ validator: FHIRObservationCategoryValidator,
2206
+ examples: ['vital-signs'],
2207
+ },
2208
+ status: {
2209
+ required: true,
2210
+ validator: FHIRObservationStatusCodeValidator,
2211
+ examples: ['final'],
2212
+ },
2213
+ value: {
2214
+ required: true,
2215
+ validator: FHIRObservationValueValidator,
2216
+ examples: [{
2217
+ unit: 'mmol',
2218
+ value: 8,
2219
+ }],
2220
+ },
2221
+ enduserId: {
2222
+ required: true,
2223
+ validator: mongoIdStringValidator,
2224
+ examples: [PLACEHOLDER_ID],
2225
+ dependencies: [{
2226
+ dependsOn: ['endusers'],
2227
+ dependencyField: '_id',
2228
+ relationship: 'foreignKey',
2229
+ onDependencyDelete: 'delete',
2230
+ }]
2231
+ },
2232
+ code: { validator: stringValidator },
2233
+ source: { validator: stringValidator },
2234
+ type: { validator: stringValidator },
2235
+ }
2236
+ },
2237
+ managed_content_records: {
2238
+ info: {},
2239
+ constraints: {
2240
+ unique: [],
2241
+ relationship: [],
2242
+ },
2243
+ defaultActions: DEFAULT_OPERATIONS,
2244
+ customActions: { },
2245
+ enduserActions: { create: {}, createMany: {}, read: {}, readMany: {} },
2246
+ fields: {
2247
+ ...BuiltInFields,
2248
+ slug: {
2249
+ validator: stringValidator250,
2250
+ },
2251
+ title: {
2252
+ validator: stringValidator100,
2253
+ required: true,
2254
+ examples: ["Template Name"],
2255
+ },
2256
+ description: {
2257
+ validator: stringValidator5000,
2258
+ examples: ["Template Subject"],
2259
+ },
2260
+ textContent: {
2261
+ validator: stringValidator25000,
2262
+ required: true,
2263
+ examples: ["This is the template message......"],
2264
+ },
2265
+ htmlContent: {
2266
+ validator: stringValidator25000,
2267
+ examples: ["This is the template message......"],
2268
+ },
2269
+ editorState: {
2270
+ validator: stringValidator25000,
2271
+ examples: ["This is the template message......"],
2272
+ },
2273
+ mode: { validator: messageTemplateModeValidator, },
2274
+ files: { validator: listOfStringsValidator },
2275
+ tags: { validator: listOfStringsValidator },
2276
+ }
2277
+ },
2278
+ forums: {
2279
+ info: {},
2280
+ constraints: {
2281
+ unique: [],
2282
+ relationship: [],
2283
+ },
2284
+ defaultActions: DEFAULT_OPERATIONS,
2285
+ customActions: { },
2286
+ enduserActions: { read: {}, readMany: {} },
2287
+ fields: {
2288
+ ...BuiltInFields,
2289
+ title: {
2290
+ validator: stringValidator100,
2291
+ required: true,
2292
+ examples: ["Template Name"],
2293
+ },
2294
+ description: {
2295
+ validator: stringValidator5000,
2296
+ examples: ["Template Subject"],
2297
+ },
2298
+ publicRead: { validator: booleanValidator }
2299
+ },
2300
+ },
2301
+ forum_posts: {
2302
+ info: {},
2303
+ constraints: {
2304
+ unique: [],
2305
+ relationship: [],
2306
+ access: [{ type: 'dependency', foreignModel: 'forums', foreignField: '_id', accessField: 'forumId' }]
2307
+ },
2308
+ defaultActions: DEFAULT_OPERATIONS,
2309
+ customActions: { },
2310
+ enduserActions: { create: {}, read: {}, readMany: {} },
2311
+ fields: {
2312
+ ...BuiltInFields,
2313
+ forumId: {
2314
+ validator: mongoIdStringValidator,
2315
+ required: true,
2316
+ examples: [PLACEHOLDER_ID],
2317
+ dependencies: [{
2318
+ dependsOn: ['forums'],
2319
+ dependencyField: '_id',
2320
+ relationship: 'foreignKey',
2321
+ onDependencyDelete: 'delete',
2322
+ }]
2323
+ },
2324
+ numComments: {
2325
+ validator: nonNegNumberValidator,
2326
+ initializer: () => 0,
2327
+ },
2328
+ numLikes: {
2329
+ validator: nonNegNumberValidator,
2330
+ initializer: () => 0,
2331
+ },
2332
+ textContent: {
2333
+ validator: stringValidator25000,
2334
+ required: true,
2335
+ examples: ["This is the template message......"],
2336
+ },
2337
+ htmlContent: {
2338
+ validator: stringValidator25000,
2339
+ examples: ["This is the template message......"],
2340
+ },
2341
+ editorState: {
2342
+ validator: stringValidator25000,
2343
+ examples: ["This is the template message......"],
2344
+ },
2345
+ },
2346
+ },
2347
+ post_comments: {
2348
+ info: {
2349
+ sideEffects: {
2350
+ create: [sideEffects.updatePostCommentCount],
2351
+ update: [sideEffects.updatePostCommentCount],
2352
+ }
2353
+ },
2354
+ constraints: {
2355
+ unique: [],
2356
+ relationship: [],
2357
+ access: [{ type: 'dependency', foreignModel: 'forums', foreignField: '_id', accessField: 'forumId' }]
2358
+ },
2359
+ defaultActions: DEFAULT_OPERATIONS,
2360
+ customActions: { },
2361
+ enduserActions: { create: {}, read: {}, readMany: {} }, // IF ADDING DELETE, make sure it's restricted on publicAccess to just the enduser
2362
+ fields: {
2363
+ ...BuiltInFields,
2364
+ forumId: {
2365
+ validator: mongoIdStringValidator,
2366
+ required: true,
2367
+ examples: [PLACEHOLDER_ID],
2368
+ dependencies: [{
2369
+ dependsOn: ['forums'],
2370
+ dependencyField: '_id',
2371
+ relationship: 'foreignKey',
2372
+ onDependencyDelete: 'delete',
2373
+ }]
2374
+ },
2375
+ postId: {
2376
+ validator: mongoIdStringValidator,
2377
+ required: true,
2378
+ examples: [PLACEHOLDER_ID],
2379
+ dependencies: [{
2380
+ dependsOn: ['forum_posts'],
2381
+ dependencyField: '_id',
2382
+ relationship: 'foreignKey',
2383
+ onDependencyDelete: 'delete',
2384
+ }]
2385
+ },
2386
+ replyTo: {
2387
+ validator: mongoIdStringValidator,
2388
+ examples: [PLACEHOLDER_ID],
2389
+ dependencies: [{
2390
+ dependsOn: ['post_comments'],
2391
+ dependencyField: '_id',
2392
+ relationship: 'foreignKey',
2393
+ onDependencyDelete: 'nop',
2394
+ }]
2395
+ },
2396
+ // numComments: {
2397
+ // validator: nonNegNumberValidator,
2398
+ // initializer: () => 0,
2399
+ // },
2400
+ // numLikes: {
2401
+ // validator: nonNegNumberValidator,
2402
+ // initializer: () => 0,
2403
+ // },
2404
+ attachments: { validator: listOfStringsValidator },
2405
+ textContent: {
2406
+ validator: stringValidator25000,
2407
+ required: true,
2408
+ examples: ["This is the template message......"],
2409
+ },
2410
+ htmlContent: {
2411
+ validator: stringValidator25000,
2412
+ examples: ["This is the template message......"],
2413
+ },
2414
+ editorState: {
2415
+ validator: stringValidator25000,
2416
+ examples: ["This is the template message......"],
2417
+ },
2418
+ },
2419
+ },
2420
+ post_likes: {
2421
+ info: {},
2422
+ constraints: {
2423
+ unique: [],
2424
+ relationship: [],
2425
+ access: [{ type: 'dependency', foreignModel: 'forums', foreignField: '_id', accessField: 'forumId' }]
2426
+ },
2427
+ defaultActions: { read: {}, readMany: {}, delete: {} }, // create is custom
2428
+ customActions: {
2429
+ create: {
2430
+ op: "custom", access: 'create', method: "post",
2431
+ name: 'Like Forum Post',
2432
+ path: '/post-like', // follows default format
2433
+ description: "Likes a post",
2434
+ parameters: {
2435
+ postId: { validator: mongoIdStringValidator, required: true },
2436
+ forumId: { validator: mongoIdStringValidator, required: true },
2437
+ },
2438
+ returns: { } //authToken: { validator: stringValidator5000 } },
2439
+ },
2440
+ unlike_post: {
2441
+ op: "custom", access: 'update', method: "post",
2442
+ name: 'Unlike Forum Post',
2443
+ path: '/unlike-forum-post',
2444
+ description: "Removes a like for a given forum post",
2445
+ parameters: {
2446
+ postId: { validator: mongoIdStringValidator, required: true },
2447
+ forumId: { validator: mongoIdStringValidator, required: true },
2448
+ },
2449
+ returns: { } //authToken: { validator: stringValidator5000 } },
2450
+ },
2451
+ },
2452
+ enduserActions: { create: {}, unlike_post: {} },
2453
+ fields: {
2454
+ ...BuiltInFields,
2455
+ forumId: {
2456
+ validator: mongoIdStringValidator,
2457
+ required: true,
2458
+ examples: [PLACEHOLDER_ID],
2459
+ dependencies: [{
2460
+ dependsOn: ['forums'],
2461
+ dependencyField: '_id',
2462
+ relationship: 'foreignKey',
2463
+ onDependencyDelete: 'delete',
2464
+ }]
2465
+ },
2466
+ postId: {
2467
+ validator: mongoIdStringValidator,
2468
+ required: true,
2469
+ examples: [PLACEHOLDER_ID],
2470
+ dependencies: [{
2471
+ dependsOn: ['forum_posts'],
2472
+ dependencyField: '_id',
2473
+ relationship: 'foreignKey',
2474
+ onDependencyDelete: 'delete',
2475
+ }]
2476
+ },
2477
+ },
2478
+ },
2177
2479
  })
2178
2480
 
2179
2481
  // export type SchemaType = typeof schema