@tellescope/schema 1.254.0 → 1.254.1

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": "1.254.0",
3
+ "version": "1.254.1",
4
4
  "description": "Schema definition for Tellescope models",
5
5
  "main": "./lib/cjs/schema.js",
6
6
  "module": "./lib/esm/schema.js",
@@ -23,13 +23,13 @@
23
23
  },
24
24
  "homepage": "https://github.com/tellescope-os/tellescope#readme",
25
25
  "dependencies": {
26
- "@tellescope/constants": "1.254.0",
27
- "@tellescope/types-client": "1.254.0",
28
- "@tellescope/types-models": "1.254.0",
29
- "@tellescope/types-server": "1.254.0",
30
- "@tellescope/types-utilities": "1.254.0",
31
- "@tellescope/utilities": "1.254.0",
32
- "@tellescope/validation": "1.254.0",
26
+ "@tellescope/constants": "1.254.1",
27
+ "@tellescope/types-client": "1.254.1",
28
+ "@tellescope/types-models": "1.254.1",
29
+ "@tellescope/types-server": "1.254.1",
30
+ "@tellescope/types-utilities": "1.254.1",
31
+ "@tellescope/utilities": "1.254.1",
32
+ "@tellescope/validation": "1.254.1",
33
33
  "validator": "13.11.0"
34
34
  },
35
35
  "devDependencies": {
@@ -43,5 +43,5 @@
43
43
  "publishConfig": {
44
44
  "access": "public"
45
45
  },
46
- "gitHead": "c1b4f17fc6da0f03c0abeebf958a7b0c4fd4217c"
46
+ "gitHead": "28444816447e007bba693810c8ebad150b83a9a5"
47
47
  }
package/src/schema.ts CHANGED
@@ -92,6 +92,7 @@ import {
92
92
  TimeTrackTimestamp,
93
93
  TimeTrackReviewHistoryItem,
94
94
  BelugaPharmacyMapping,
95
+ CompoundFilter,
95
96
  BelugaAutomationMappingEntry,
96
97
  BelugaUpdateVisitPatientPreferenceItem,
97
98
  TimeTrack,
@@ -3189,9 +3190,21 @@ export const schema: SchemaV1 = build_schema({
3189
3190
  },
3190
3191
  chat_rooms: {
3191
3192
  info: {},
3192
- constraints: {
3193
+ constraints: {
3193
3194
  unique: [{ array: 'userIds' }, { array: 'enduserIds' }],
3194
- relationship: [],
3195
+ relationship: [
3196
+ {
3197
+ // Patient-initiated rooms targeting specific care-team staff (userIds) are an intended
3198
+ // portal feature and are left unrestricted. An enduser may only add THEMSELVES to a room
3199
+ // they create — they cannot add other patients (cross-patient PHI broadcast).
3200
+ explanation: 'Endusers can only add their own id to enduserIds on chat rooms they create',
3201
+ evaluate: (doc, _, session) => {
3202
+ if (session.type !== ENDUSER_SESSION_TYPE) return
3203
+ if ((doc.enduserIds ?? []).some(id => id !== session.id))
3204
+ return "enduserIds may only contain your own id for enduser session"
3205
+ }
3206
+ },
3207
+ ],
3195
3208
  access: [
3196
3209
  { type: 'filter', field: 'userIds' },
3197
3210
  { type: 'filter', field: 'enduserIds' },
@@ -4846,8 +4859,9 @@ export const schema: SchemaV1 = build_schema({
4846
4859
  },
4847
4860
  belugaCombineMatchingPharmacyMappings: { validator: booleanValidator },
4848
4861
  mdiCaseOfferings: {
4849
- validator: listValidatorOptionalOrEmptyOk(objectValidator<{ offering_id: string }>({
4862
+ validator: listValidatorOptionalOrEmptyOk(objectValidator<{ offering_id: string, conditions?: CompoundFilter<string> }>({
4850
4863
  offering_id: stringValidator100,
4864
+ conditions: compoundFilterValidator,
4851
4865
  }))
4852
4866
  },
4853
4867
  autoMergeOnSubmission: { validator: booleanValidator },
@@ -6457,8 +6471,16 @@ export const schema: SchemaV1 = build_schema({
6457
6471
  enduser_observations: {
6458
6472
  info: {},
6459
6473
  constraints: {
6460
- unique: [],
6461
- relationship: [],
6474
+ unique: [],
6475
+ relationship: [
6476
+ {
6477
+ explanation: 'When created by an enduser, enduserId must match their id',
6478
+ evaluate: ({ enduserId },_,session) => {
6479
+ if (session.type === ENDUSER_SESSION_TYPE && session.id !== enduserId)
6480
+ return "enduserId does not match creator id for enduser session"
6481
+ }
6482
+ },
6483
+ ],
6462
6484
  },
6463
6485
  defaultActions: {
6464
6486
  ...DEFAULT_OPERATIONS,
@@ -6559,11 +6581,23 @@ export const schema: SchemaV1 = build_schema({
6559
6581
  managed_content_records: {
6560
6582
  info: {},
6561
6583
  constraints: {
6562
- unique: [],
6563
- relationship: [],
6584
+ unique: [],
6585
+ relationship: [
6586
+ {
6587
+ explanation: 'Endusers cannot self-publish managed content or bind it to another enduser',
6588
+ evaluate: (doc, _, session) => {
6589
+ if (session.type !== ENDUSER_SESSION_TYPE) return
6590
+ if (doc.publicRead) return "publicRead cannot be set by endusers"
6591
+ if (doc.allowUnauthenticatedAccess) return "allowUnauthenticatedAccess cannot be set by endusers"
6592
+ if (doc.forInternalUse) return "forInternalUse cannot be set by endusers"
6593
+ if (doc.enduserId !== undefined && doc.enduserId !== session.id)
6594
+ return "enduserId does not match creator id for enduser session"
6595
+ }
6596
+ },
6597
+ ],
6564
6598
  },
6565
6599
  defaultActions: DEFAULT_OPERATIONS,
6566
- customActions: {
6600
+ customActions: {
6567
6601
  update_indexes: {
6568
6602
  op: "custom", access: 'update', method: "patch",
6569
6603
  name: 'Update Indexes',
@@ -9368,8 +9402,17 @@ If a voicemail is left, it is indicated by recordingURI, transcription, or recor
9368
9402
  info: {
9369
9403
  description: 'Lab, medication, and device orders'
9370
9404
  },
9371
- constraints: {
9372
- unique: [], relationship: [],
9405
+ constraints: {
9406
+ unique: [],
9407
+ relationship: [
9408
+ {
9409
+ explanation: 'When created by an enduser, enduserId must match their id',
9410
+ evaluate: ({ enduserId },_,session) => {
9411
+ if (session.type === ENDUSER_SESSION_TYPE && session.id !== enduserId)
9412
+ return "enduserId does not match creator id for enduser session"
9413
+ }
9414
+ },
9415
+ ],
9373
9416
  access: [{ type: 'filter', field: 'userId' }]
9374
9417
  },
9375
9418
  defaultActions: DEFAULT_OPERATIONS,