gdc-sdk-node-ts 2.4.44 → 2.4.45
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.
|
@@ -2,6 +2,7 @@ import { type ConsentRule } from 'gdc-common-utils-ts/models/consent-rule';
|
|
|
2
2
|
import type { ActiveConsentProvider } from 'gdc-sdk-core-ts';
|
|
3
3
|
import type { RouteContext } from './individual-onboarding.js';
|
|
4
4
|
import { type NodeRuntimeClient } from './orchestration/client-port.js';
|
|
5
|
+
import type { SubjectConsentSearchInput } from './resource-operations.js';
|
|
5
6
|
/**
|
|
6
7
|
* GW-backed implementation of the runtime-neutral ActiveConsentProvider.
|
|
7
8
|
*
|
|
@@ -13,7 +14,7 @@ export declare class GatewayActiveConsentProvider implements ActiveConsentProvid
|
|
|
13
14
|
private readonly routeContext;
|
|
14
15
|
constructor(client: NodeRuntimeClient, routeContext: RouteContext);
|
|
15
16
|
/** Loads and normalizes the active Consent rules owned by one subject. */
|
|
16
|
-
getActiveConsentsForSubject(subject: string): Promise<ConsentRule[]>;
|
|
17
|
+
getActiveConsentsForSubject(subject: string, filters?: Omit<SubjectConsentSearchInput, 'subject' | 'pollOptions'>): Promise<ConsentRule[]>;
|
|
17
18
|
}
|
|
18
19
|
/** Extracts canonical Consent claim maps from current GW Bundle wrappers. */
|
|
19
20
|
export declare function extractConsentRules(value: unknown): ConsentRule[];
|
|
@@ -14,12 +14,12 @@ export class GatewayActiveConsentProvider {
|
|
|
14
14
|
this.routeContext = routeContext;
|
|
15
15
|
}
|
|
16
16
|
/** Loads and normalizes the active Consent rules owned by one subject. */
|
|
17
|
-
async getActiveConsentsForSubject(subject) {
|
|
17
|
+
async getActiveConsentsForSubject(subject, filters = {}) {
|
|
18
18
|
const normalizedSubject = String(subject || '').trim();
|
|
19
19
|
if (!normalizedSubject.startsWith('did:')) {
|
|
20
20
|
throw new Error('Active Consent lookup requires a subject DID.');
|
|
21
21
|
}
|
|
22
|
-
const result = await requireClientMethod(this.client, 'searchSubjectConsents')(this.routeContext, { subject: normalizedSubject });
|
|
22
|
+
const result = await requireClientMethod(this.client, 'searchSubjectConsents')(this.routeContext, { subject: normalizedSubject, ...filters });
|
|
23
23
|
return extractConsentRules(result.poll.body)
|
|
24
24
|
.filter((rule) => isConsentRuleActive(rule, { subject: normalizedSubject }));
|
|
25
25
|
}
|
|
@@ -216,7 +216,12 @@ export class IndividualControllerSdk {
|
|
|
216
216
|
async getDigitalTwinSecondaryUseConsentStatus(ctx, input) {
|
|
217
217
|
assertFacadeCapability(this.capabilities, ActorCapabilities.IndividualGenerateDigitalTwin, ActorKinds.IndividualController, 'getDigitalTwinSecondaryUseConsentStatus');
|
|
218
218
|
const consents = await new GatewayActiveConsentProvider(this.client, ctx)
|
|
219
|
-
.getActiveConsentsForSubject(input.subjectDid
|
|
219
|
+
.getActiveConsentsForSubject(input.subjectDid, {
|
|
220
|
+
actorIdentifier: input.indexProviderOrganizationDid,
|
|
221
|
+
purpose: HealthcareConsentPurposes.Research,
|
|
222
|
+
action: ServiceCapability.DigitalTwinReader,
|
|
223
|
+
sourceReference: input.researchUseReference,
|
|
224
|
+
});
|
|
220
225
|
const researchUseReference = String(input.researchUseReference || '').trim();
|
|
221
226
|
if (!researchUseReference)
|
|
222
227
|
throw new Error('researchUseReference is required to identify the portal, software or study consent.');
|
|
@@ -535,6 +535,10 @@ export type DigitalTwinSubjectLinkPurgeResult = SubmitAndPollResult;
|
|
|
535
535
|
/** Input for reading the subject-owned Consent records through its individual aggregate. */
|
|
536
536
|
export type SubjectConsentSearchInput = Readonly<{
|
|
537
537
|
subject: string;
|
|
538
|
+
actorIdentifier?: string;
|
|
539
|
+
purpose?: string;
|
|
540
|
+
action?: string;
|
|
541
|
+
sourceReference?: string;
|
|
538
542
|
pollOptions?: {
|
|
539
543
|
timeoutMs?: number;
|
|
540
544
|
intervalMs?: number;
|
|
@@ -877,9 +877,20 @@ export async function searchSubjectConsentsWithDeps(routeCtx, input, deps) {
|
|
|
877
877
|
throw new Error('Consent search requires a subject DID.');
|
|
878
878
|
}
|
|
879
879
|
const format = 'org.hl7.fhir.r4';
|
|
880
|
+
const optionalParameters = [
|
|
881
|
+
['actor-identifier', input.actorIdentifier],
|
|
882
|
+
['purpose', input.purpose],
|
|
883
|
+
['action', input.action],
|
|
884
|
+
['source-reference', input.sourceReference],
|
|
885
|
+
];
|
|
880
886
|
const parameters = {
|
|
881
887
|
resourceType: 'Parameters',
|
|
882
|
-
parameter: [
|
|
888
|
+
parameter: [
|
|
889
|
+
{ name: 'subject', valueString: subject },
|
|
890
|
+
...optionalParameters
|
|
891
|
+
.map(([name, rawValue]) => ({ name, valueString: String(rawValue || '').trim() }))
|
|
892
|
+
.filter((parameter) => parameter.valueString),
|
|
893
|
+
],
|
|
883
894
|
};
|
|
884
895
|
const thid = `subject-consent-search-${createRuntimeUuid()}`;
|
|
885
896
|
const communication = {
|