vintasend-medplum 0.13.2 → 0.14.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.
|
@@ -36,6 +36,7 @@ export declare class MedplumNotificationBackend<Config extends BaseNotificationT
|
|
|
36
36
|
'fields.bodyTemplate': boolean;
|
|
37
37
|
'fields.subjectTemplate': boolean;
|
|
38
38
|
'fields.contextName': boolean;
|
|
39
|
+
'fields.tenant': boolean;
|
|
39
40
|
'fields.sendAfterRange': boolean;
|
|
40
41
|
'fields.createdAtRange': boolean;
|
|
41
42
|
'fields.sentAtRange': boolean;
|
|
@@ -70,6 +71,15 @@ export declare class MedplumNotificationBackend<Config extends BaseNotificationT
|
|
|
70
71
|
id?: Config['NotificationIdType'];
|
|
71
72
|
}): Promise<DatabaseNotification<Config>>;
|
|
72
73
|
persistNotificationUpdate(notificationId: Config['NotificationIdType'], notification: Partial<Omit<Notification<Config>, 'id'>>): Promise<DatabaseNotification<Config>>;
|
|
74
|
+
/**
|
|
75
|
+
* Guard against tenant reassignment on update. Changing a Communication's
|
|
76
|
+
* tenant would move it into a different compartment and could leak data
|
|
77
|
+
* across tenant boundaries, so we reject any update that tries to change
|
|
78
|
+
* the tenant. Idempotent updates (same tenant, or no tenant field) are
|
|
79
|
+
* allowed so service-layer code that spreads the full notification through
|
|
80
|
+
* replication still works.
|
|
81
|
+
*/
|
|
82
|
+
private assertTenantUnchanged;
|
|
73
83
|
applyReplicationSnapshotIfNewer(snapshot: AnyDatabaseNotification<Config>): Promise<{
|
|
74
84
|
applied: boolean;
|
|
75
85
|
}>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"medplum-backend.d.ts","sourceRoot":"","sources":["../src/medplum-backend.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAEnD,OAAO,KAAK,EACV,uBAAuB,EAEvB,oBAAoB,EACpB,qBAAqB,EACrB,UAAU,EACV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AC;IAyC5E;;;OAGG;IACG,uBAAuB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,oBAAoB,GAAG,IAAI,CAAC;IASnF;;;OAGG;IACH,OAAO,CAAC,2BAA2B;IAiDnC;;OAEG;YACW,oBAAoB;IAWlC;;OAEG;IACH,OAAO,CAAC,2BAA2B;IAK7B,4BAA4B,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,oBAAoB,GAAG,IAAI,CAAC;IAkB1F;;OAEG;YACW,8BAA8B;IAmC5C;;;;OAIG;YACW,kBAAkB;IAmH1B,oBAAoB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAsBzD;;OAEG;YACW,+BAA+B;IAcvC,0BAA0B,IAAI,OAAO,CAAC,oBAAoB,EAAE,CAAC;IAiC7D,cAAc,CAAC,cAAc,EAAE,MAAM,CAAC,oBAAoB,CAAC,GAAG,OAAO,CAAC,gBAAgB,EAAE,CAAC;IAmGzF,4BAA4B,CAChC,cAAc,EAAE,MAAM,CAAC,oBAAoB,CAAC,EAC5C,YAAY,EAAE,MAAM,GACnB,OAAO,CAAC,IAAI,CAAC;CA8BjB;AAED,qBAAa,iCAAiC,CAAC,MAAM,SAAS,0BAA0B;IACtF,MAAM,CAAC,OAAO,EAAE,aAAa,EAAE,OAAO,CAAC,EAAE,iCAAiC;CAG3E"}
|
package/dist/medplum-backend.js
CHANGED
|
@@ -50,6 +50,7 @@ export class MedplumNotificationBackend {
|
|
|
50
50
|
'fields.bodyTemplate': true,
|
|
51
51
|
'fields.subjectTemplate': true,
|
|
52
52
|
'fields.contextName': true,
|
|
53
|
+
'fields.tenant': true,
|
|
53
54
|
'fields.sendAfterRange': true,
|
|
54
55
|
'fields.createdAtRange': true,
|
|
55
56
|
'fields.sentAtRange': true,
|
|
@@ -152,6 +153,7 @@ export class MedplumNotificationBackend {
|
|
|
152
153
|
bodyTemplate,
|
|
153
154
|
subjectTemplate: subjectTemplateFromId,
|
|
154
155
|
extraParams: {},
|
|
156
|
+
tenant: communication.meta?.accounts?.[0]?.reference ?? null,
|
|
155
157
|
status: communication.status === 'completed'
|
|
156
158
|
? 'SENT'
|
|
157
159
|
: communication.status === 'stopped'
|
|
@@ -247,7 +249,7 @@ export class MedplumNotificationBackend {
|
|
|
247
249
|
.filter((n) => 'userId' in n);
|
|
248
250
|
}
|
|
249
251
|
async persistNotification(notification) {
|
|
250
|
-
const
|
|
252
|
+
const notificationWithOptionalFields = notification;
|
|
251
253
|
// Build base payload with body template
|
|
252
254
|
const payload = notification.bodyTemplate
|
|
253
255
|
? [
|
|
@@ -280,12 +282,15 @@ export class MedplumNotificationBackend {
|
|
|
280
282
|
value: notification.subjectTemplate,
|
|
281
283
|
});
|
|
282
284
|
}
|
|
283
|
-
if (
|
|
285
|
+
if (notificationWithOptionalFields.gitCommitSha) {
|
|
284
286
|
identifiers.push({
|
|
285
287
|
system: IDENTIFIER_SYSTEMS.gitCommitSha,
|
|
286
|
-
value:
|
|
288
|
+
value: notificationWithOptionalFields.gitCommitSha,
|
|
287
289
|
});
|
|
288
290
|
}
|
|
291
|
+
// Assign tenant compartment via meta.accounts. Medplum populates meta.compartment
|
|
292
|
+
// server-side from this, which AccessPolicies use for multi-tenant access control.
|
|
293
|
+
// See: https://www.medplum.com/docs/access/multi-tenant-access-policy
|
|
289
294
|
const communication = {
|
|
290
295
|
resourceType: 'Communication',
|
|
291
296
|
...(notification.id ? { id: notification.id } : {}),
|
|
@@ -302,6 +307,9 @@ export class MedplumNotificationBackend {
|
|
|
302
307
|
{ code: notification.contextName },
|
|
303
308
|
{ code: notification.notificationType },
|
|
304
309
|
],
|
|
310
|
+
...(notificationWithOptionalFields.tenant
|
|
311
|
+
? { accounts: [{ reference: notificationWithOptionalFields.tenant }] }
|
|
312
|
+
: {}),
|
|
305
313
|
},
|
|
306
314
|
};
|
|
307
315
|
const created = await this.medplum.createResource(communication);
|
|
@@ -316,6 +324,7 @@ export class MedplumNotificationBackend {
|
|
|
316
324
|
}
|
|
317
325
|
async persistNotificationUpdate(notificationId, notification) {
|
|
318
326
|
const existing = await this.medplum.readResource('Communication', notificationId);
|
|
327
|
+
this.assertTenantUnchanged(existing, notification, notificationId);
|
|
319
328
|
const status = 'status' in notification ? notification.status : undefined;
|
|
320
329
|
const subjectTemplate = 'subjectTemplate' in notification ? notification.subjectTemplate : undefined;
|
|
321
330
|
// Update identifiers for searchable fields when they change
|
|
@@ -336,6 +345,24 @@ export class MedplumNotificationBackend {
|
|
|
336
345
|
const result = await this.medplum.updateResource(updated);
|
|
337
346
|
return this.mapToDatabaseNotification(result);
|
|
338
347
|
}
|
|
348
|
+
/**
|
|
349
|
+
* Guard against tenant reassignment on update. Changing a Communication's
|
|
350
|
+
* tenant would move it into a different compartment and could leak data
|
|
351
|
+
* across tenant boundaries, so we reject any update that tries to change
|
|
352
|
+
* the tenant. Idempotent updates (same tenant, or no tenant field) are
|
|
353
|
+
* allowed so service-layer code that spreads the full notification through
|
|
354
|
+
* replication still works.
|
|
355
|
+
*/
|
|
356
|
+
assertTenantUnchanged(existing, notification, notificationId) {
|
|
357
|
+
if (!('tenant' in notification))
|
|
358
|
+
return;
|
|
359
|
+
const incoming = notification.tenant ?? null;
|
|
360
|
+
const current = existing.meta?.accounts?.[0]?.reference ?? null;
|
|
361
|
+
if (incoming !== current) {
|
|
362
|
+
throw new Error(`Cannot update tenant of notification ${String(notificationId)}: ` +
|
|
363
|
+
`tenant reassignment is not allowed (existing=${current ?? 'null'}, incoming=${incoming ?? 'null'}).`);
|
|
364
|
+
}
|
|
365
|
+
}
|
|
339
366
|
async applyReplicationSnapshotIfNewer(snapshot) {
|
|
340
367
|
const existingNotification = await this.getNotification(snapshot.id, false);
|
|
341
368
|
if (existingNotification?.updatedAt &&
|
|
@@ -450,11 +477,11 @@ export class MedplumNotificationBackend {
|
|
|
450
477
|
value: notification.subjectTemplate,
|
|
451
478
|
});
|
|
452
479
|
}
|
|
453
|
-
const
|
|
454
|
-
if (
|
|
480
|
+
const notificationWithOptionalFields = notification;
|
|
481
|
+
if (notificationWithOptionalFields.gitCommitSha) {
|
|
455
482
|
bulkIdentifiers.push({
|
|
456
483
|
system: IDENTIFIER_SYSTEMS.gitCommitSha,
|
|
457
|
-
value:
|
|
484
|
+
value: notificationWithOptionalFields.gitCommitSha,
|
|
458
485
|
});
|
|
459
486
|
}
|
|
460
487
|
const communication = {
|
|
@@ -486,6 +513,9 @@ export class MedplumNotificationBackend {
|
|
|
486
513
|
{ code: notification.contextName },
|
|
487
514
|
{ code: notification.notificationType },
|
|
488
515
|
],
|
|
516
|
+
...(notificationWithOptionalFields.tenant
|
|
517
|
+
? { accounts: [{ reference: notificationWithOptionalFields.tenant }] }
|
|
518
|
+
: {}),
|
|
489
519
|
},
|
|
490
520
|
};
|
|
491
521
|
const created = await this.medplum.createResource(communication);
|
|
@@ -623,7 +653,7 @@ export class MedplumNotificationBackend {
|
|
|
623
653
|
}
|
|
624
654
|
/* One-off notification methods */
|
|
625
655
|
async persistOneOffNotification(notification) {
|
|
626
|
-
const
|
|
656
|
+
const notificationWithOptionalFields = notification;
|
|
627
657
|
// Build base payload with body template
|
|
628
658
|
const payload = notification.bodyTemplate
|
|
629
659
|
? [
|
|
@@ -656,10 +686,10 @@ export class MedplumNotificationBackend {
|
|
|
656
686
|
value: notification.subjectTemplate,
|
|
657
687
|
});
|
|
658
688
|
}
|
|
659
|
-
if (
|
|
689
|
+
if (notificationWithOptionalFields.gitCommitSha) {
|
|
660
690
|
oneOffIdentifiers.push({
|
|
661
691
|
system: IDENTIFIER_SYSTEMS.gitCommitSha,
|
|
662
|
-
value:
|
|
692
|
+
value: notificationWithOptionalFields.gitCommitSha,
|
|
663
693
|
});
|
|
664
694
|
}
|
|
665
695
|
const communication = {
|
|
@@ -692,6 +722,9 @@ export class MedplumNotificationBackend {
|
|
|
692
722
|
{ code: notification.notificationType },
|
|
693
723
|
{ code: 'one-off' },
|
|
694
724
|
],
|
|
725
|
+
...(notificationWithOptionalFields.tenant
|
|
726
|
+
? { accounts: [{ reference: notificationWithOptionalFields.tenant }] }
|
|
727
|
+
: {}),
|
|
695
728
|
},
|
|
696
729
|
};
|
|
697
730
|
const created = await this.medplum.createResource(communication);
|
|
@@ -704,6 +737,7 @@ export class MedplumNotificationBackend {
|
|
|
704
737
|
}
|
|
705
738
|
async persistOneOffNotificationUpdate(notificationId, notification) {
|
|
706
739
|
const existing = await this.medplum.readResource('Communication', notificationId);
|
|
740
|
+
this.assertTenantUnchanged(existing, notification, notificationId);
|
|
707
741
|
const status = 'status' in notification ? notification.status : undefined;
|
|
708
742
|
const subjectTemplate = 'subjectTemplate' in notification ? notification.subjectTemplate : undefined;
|
|
709
743
|
const existingIdentifiers = existing.identifier || [];
|
|
@@ -917,6 +951,12 @@ export class MedplumNotificationBackend {
|
|
|
917
951
|
? `${params.identifier},${IDENTIFIER_SYSTEMS.subjectTemplate}|${subjectTemplate}`
|
|
918
952
|
: `${IDENTIFIER_SYSTEMS.subjectTemplate}|${subjectTemplate}`;
|
|
919
953
|
}
|
|
954
|
+
// tenant → _compartment search parameter (multi-tenant access via meta.accounts)
|
|
955
|
+
if (filter.tenant !== undefined) {
|
|
956
|
+
const tenants = Array.isArray(filter.tenant) ? filter.tenant : [filter.tenant];
|
|
957
|
+
// FHIR comma-separated values mean OR; Medplum supports this for _compartment
|
|
958
|
+
params._compartment = tenants.join(',');
|
|
959
|
+
}
|
|
920
960
|
// sendAfterRange → sent date comparators
|
|
921
961
|
if (filter.sendAfterRange) {
|
|
922
962
|
if (filter.sendAfterRange.from) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vintasend-medplum",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.14.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
"@medplum/fhirtypes": "^5.1.1",
|
|
25
25
|
"pdfmake": "^0.2.5",
|
|
26
26
|
"pug": "^3.0.3",
|
|
27
|
-
"vintasend": "^0.
|
|
27
|
+
"vintasend": "^0.14.0"
|
|
28
28
|
},
|
|
29
29
|
"devDependencies": {
|
|
30
30
|
"@biomejs/biome": "^2.4.5",
|
|
@@ -38,6 +38,6 @@
|
|
|
38
38
|
"ts-node": "^10.9.2",
|
|
39
39
|
"typescript": "^5.9.3",
|
|
40
40
|
"vitest": "4.0.18",
|
|
41
|
-
"vintasend": "^0.
|
|
41
|
+
"vintasend": "^0.14.0"
|
|
42
42
|
}
|
|
43
43
|
}
|