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