@tellescope/schema 0.0.97 → 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/lib/cjs/schema.d.ts +15 -0
- package/lib/cjs/schema.d.ts.map +1 -1
- package/lib/cjs/schema.js +254 -5
- 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 +253 -4
- package/lib/esm/schema.js.map +1 -1
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/package.json +8 -8
- package/src/schema.ts +308 -2
package/src/schema.ts
CHANGED
|
@@ -97,6 +97,10 @@ import {
|
|
|
97
97
|
CUDStringValidator,
|
|
98
98
|
listOfRelatedRecordsValidator,
|
|
99
99
|
cancelConditionsValidator,
|
|
100
|
+
notificationPreferencesValidator,
|
|
101
|
+
FHIRObservationCategoryValidator,
|
|
102
|
+
FHIRObservationStatusCodeValidator,
|
|
103
|
+
FHIRObservationValueValidator,
|
|
100
104
|
} from "@tellescope/validation"
|
|
101
105
|
|
|
102
106
|
import {
|
|
@@ -246,7 +250,11 @@ const sideEffects = {
|
|
|
246
250
|
updateEnduserStatus: {
|
|
247
251
|
name: "updateEnduserStatus",
|
|
248
252
|
description: "Updates the journeys[journeyId] field in an enduser to reflect a new status update"
|
|
249
|
-
}
|
|
253
|
+
},
|
|
254
|
+
updatePostCommentCount: {
|
|
255
|
+
name: "updatePostCommentCount",
|
|
256
|
+
description: "Updates the comment count of a post"
|
|
257
|
+
},
|
|
250
258
|
}
|
|
251
259
|
export type SideEffectNames = keyof typeof sideEffects
|
|
252
260
|
|
|
@@ -308,7 +316,7 @@ export type CustomActions = {
|
|
|
308
316
|
display_info: CustomAction<{ id: string }, { id: string, display_info: { [index: string]: UserDisplayInfo } }>,
|
|
309
317
|
},
|
|
310
318
|
meetings: {
|
|
311
|
-
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 }>,
|
|
312
320
|
send_invite: CustomAction<{ meetingId: string, enduserId: string }, { }>,
|
|
313
321
|
end_meeting: CustomAction<{ id: string }, { }>,
|
|
314
322
|
add_attendees_to_meeting: CustomAction<{ id: string, attendees: UserIdentity[] }, { }>,
|
|
@@ -324,6 +332,10 @@ export type CustomActions = {
|
|
|
324
332
|
},
|
|
325
333
|
user_notifications: {
|
|
326
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 }, { }>,
|
|
327
339
|
}
|
|
328
340
|
}
|
|
329
341
|
|
|
@@ -1311,6 +1323,9 @@ export const schema: SchemaV1 = build_schema({
|
|
|
1311
1323
|
validator: stringValidator,
|
|
1312
1324
|
readonly: true, // update via separate password reset function
|
|
1313
1325
|
},
|
|
1326
|
+
notificationPreferences: {
|
|
1327
|
+
validator: notificationPreferencesValidator,
|
|
1328
|
+
},
|
|
1314
1329
|
avatar: {
|
|
1315
1330
|
validator: stringValidator100,
|
|
1316
1331
|
dependencies: [
|
|
@@ -1526,6 +1541,7 @@ export const schema: SchemaV1 = build_schema({
|
|
|
1526
1541
|
description: "Generates an video meeting room",
|
|
1527
1542
|
parameters: {
|
|
1528
1543
|
attendees: { validator: listOfUserIndentitiesValidator },
|
|
1544
|
+
publicRead: { validator: booleanValidator },
|
|
1529
1545
|
},
|
|
1530
1546
|
returns: {
|
|
1531
1547
|
id: { validator: mongoIdStringValidator, required: true },
|
|
@@ -1602,6 +1618,7 @@ export const schema: SchemaV1 = build_schema({
|
|
|
1602
1618
|
validator: meetingInfoValidator,
|
|
1603
1619
|
readonly: true
|
|
1604
1620
|
},
|
|
1621
|
+
publicRead: { validator: booleanValidator },
|
|
1605
1622
|
endedAt: { validator: dateValidator },
|
|
1606
1623
|
}
|
|
1607
1624
|
},
|
|
@@ -1910,6 +1927,8 @@ export const schema: SchemaV1 = build_schema({
|
|
|
1910
1927
|
validator: listOfCalendarEventRemindersValidator,
|
|
1911
1928
|
initializer: () => [],
|
|
1912
1929
|
},
|
|
1930
|
+
publicRead: { validator: booleanValidator },
|
|
1931
|
+
displayImage: { validator: stringValidator },
|
|
1913
1932
|
fields: { validator: fieldsValidator },
|
|
1914
1933
|
}
|
|
1915
1934
|
},
|
|
@@ -2170,6 +2189,293 @@ export const schema: SchemaV1 = build_schema({
|
|
|
2170
2189
|
relatedRecords: { validator: listOfRelatedRecordsValidator },
|
|
2171
2190
|
}
|
|
2172
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
|
+
},
|
|
2173
2479
|
})
|
|
2174
2480
|
|
|
2175
2481
|
// export type SchemaType = typeof schema
|