import { type IndividualControllerCredentialInput, type IndividualControllerVpPayloadInput, type IndividualSubjectCredentialInput } from 'gdc-common-utils-ts'; import { type NodeRuntimeClient, type PollOptions, type SubmitAndPollResult, type SubmitPayload } from './client-port.js'; import type { FamilyOrganizationSummary } from 'gdc-common-utils-ts/utils/family-organization-summary'; import type { EnsureFamilyOrganizationRegistrationInput, EnsureFamilyOrganizationRegistrationResult } from '../family-organization-registration.js'; import type { FamilyOrganizationSearchInput } from '../family-organization-search.js'; import type { IndividualOrganizationConfirmOrderInput, IndividualOrganizationOrderResult, RouteContext } from '../individual-onboarding.js'; import type { IndividualOrganizationRegistrationInput, IndividualOrganizationRegistrationResult } from '../individual-start.js'; import type { NodeCapability } from '../session.js'; import type { IndividualOrganizationLifecycleInput } from 'gdc-sdk-core-ts'; import type { BlockchainArtifactRegistrationInput, ClinicalBundleSearchInput, ClinicalSectionUpdateInput, SubjectSectionUpdateInput, ClinicalSummaryReadResult, ClinicalSummaryRequestInput, ClinicalSummaryUpdateInput, CommunicationIngestionInput, CommunicationParticipantRuntimeSearchInput, DigitalTwinGenerationInput, DigitalTwinSecondaryUseConsentInput, DigitalTwinSecondaryUseConsentResult, DigitalTwinSubjectLinkPurgeInput, DigitalTwinSubjectLinkPurgeResult, GrantProfessionalAccessInput, GrantProfessionalAccessResult, IndividualMemberLifecycleInput, IndividualMemberLicenseAddInput, IndividualMemberLicenseInvitationInput, IndividualMemberLicenseTransitionInput, IpsOrFhirImportInput, LicenseListRuntimeSearchInput, LicenseOfferRuntimeSearchInput, LicenseOrderRuntimeSearchInput, RevokeProfessionalAccessInput, RevokeProfessionalAccessResult, ProfessionalAccessRequestDecisionInput, ProfessionalAccessRequestSearchInput, RelatedPersonUpsertInput } from '../resource-operations.js'; import type { SmartTokenExchangeResult, SmartTokenRequestInput } from '../smart-token.js'; /** * Legacy compatibility default applied after unlock. * * New writes should pass the selected relationship explicitly as the * document's `attester`; this default is retained so existing integrations do * not break during the transition. */ export type IndividualControllerProfileDefaults = Readonly<{ attester: SubjectSectionUpdateInput['attester']; }>; /** * High-level section input. New writes pass the document attester explicitly. * The optional shape remains compatible with opened facades created by older * integrations, which still supply their protected RESPRSN assignment. */ export type IndividualControllerSubjectSectionUpdateInput = Omit & Partial>; /** * Individual-controller oriented facade over a `NodeRuntimeClient`. * * It groups the most common individual subject flows: organization/index * bootstrap, consent, IPS/FHIR ingestion, digital twin generation, and token requests. */ export declare class IndividualControllerSdk { private readonly client; private readonly capabilities?; private readonly profileDefaults?; /** * @param client Runtime client implementation used to submit and poll GW flows. */ constructor(client: NodeRuntimeClient, capabilities?: readonly NodeCapability[] | undefined, profileDefaults?: IndividualControllerProfileDefaults | undefined); /** * Registers the personal organization/subject index and returns its Offer. * Wallet creation, activation exchange, DCR, and session opening are later * `ServerProfileSessionManager` phases. */ registerIndividualOrganization(input: IndividualOrganizationRegistrationInput): Promise; /** @deprecated Use `registerIndividualOrganization`. */ startIndividualOrganization(input: IndividualOrganizationRegistrationInput): Promise; /** * Searches one existing family/individual registration by the phone-first * business key used by channel apps. */ searchFamilyOrganization(ctx: RouteContext, input: FamilyOrganizationSearchInput): Promise; /** * Searches one existing family/individual registration and starts the * bootstrap flow only when the registration is still missing. */ ensureFamilyOrganizationRegistration(ctx: RouteContext, input: EnsureFamilyOrganizationRegistrationInput): Promise; /** * Confirms the Offer returned by `registerIndividualOrganization(...)` and * returns the opaque controller `activationCode` required by profile * enrollment. */ confirmIndividualOrganizationOrder(input: IndividualOrganizationConfirmOrderInput): Promise; /** * Disables the hosted individual/family organization without freeing licenses. */ disableIndividualOrganization(ctx: RouteContext, input: IndividualOrganizationLifecycleInput, pollOptions?: PollOptions): Promise; /** * Preferred public alias for hosted individual/family disable. */ disableIndividual(ctx: RouteContext, input: IndividualOrganizationLifecycleInput, pollOptions?: PollOptions): Promise; /** * Purges an already inactive hosted individual/family organization. */ purgeIndividualOrganization(ctx: RouteContext, input: IndividualOrganizationLifecycleInput, pollOptions?: PollOptions): Promise; /** * Preferred public alias for hosted individual/family purge. */ purgeIndividual(ctx: RouteContext, input: IndividualOrganizationLifecycleInput, pollOptions?: PollOptions): Promise; /** * Soft-disables one individual-member / caregiver relationship through the * current `RelatedPerson/_batch` lifecycle contract. */ disableIndividualMember(ctx: RouteContext, input: IndividualMemberLifecycleInput, pollOptions?: PollOptions): Promise; /** * Purges one previously disabled individual-member / caregiver relationship * through the explicit `RelatedPerson/_purge` lifecycle contract. */ purgeIndividualMember(ctx: RouteContext, input: IndividualMemberLifecycleInput, pollOptions?: PollOptions): Promise; /** * Grants access to a professional through a consent flow. */ grantProfessionalAccess(ctx: RouteContext, input: GrantProfessionalAccessInput): Promise; /** Approves or denies a permission request while retaining its correlation. */ respondToProfessionalAccessRequest(ctx: RouteContext, input: ProfessionalAccessRequestDecisionInput): Promise; /** Lists canonical permission requests addressed to this subject. */ listProfessionalAccessRequests(ctx: RouteContext, input: ProfessionalAccessRequestSearchInput): Promise; /** * Closes an existing professional consent by setting its period end. */ revokeProfessionalAccess(ctx: RouteContext, input: RevokeProfessionalAccessInput): Promise; /** * Imports a FHIR/IPS payload and waits until it is indexed. * * The source `Composition.author` is provenance, not delegated authority. * A controller that imports an IPS authored by an external URN does not gain * permission to rewrite or delete it. A correction requires independently * verified source provenance; merely resubmitting the same URN is * insufficient and unsigned/demo imports remain locally immutable. * * @deprecated Use `updateClinicalSummary(...)` for complete FHIR documents * or `updateSubjectSection(...)` for typed section changes. Both use the * Communication ingestion flow. */ importIpsOrFhirAndUpdateIndex(ctx: RouteContext, input: IpsOrFhirImportInput): Promise; /** * Compatibility adapter for the older direct `RelatedPerson` route. * * @deprecated Author one or more typed RelatedPerson entries in a Bundle, * attach that completed Bundle to a Communication outbox job, and call * `ingestCommunicationAndUpdateIndex(...)`. */ upsertRelatedPersonAndPoll(ctx: RouteContext, input: RelatedPersonUpsertInput): Promise; /** * Ingests a FHIR `Communication` and waits for indexing. */ ingestCommunicationAndUpdateIndex(ctx: RouteContext, input: CommunicationIngestionInput): Promise; /** * Updates one exact clinical section through a section-scoped batch. * Entries choose their own operation, so one call may create one resource * and delete another with `.delete()` and optional `.ifMatch(versionId)`. * DELETE entries contain no resource body. */ updateClinicalSection(ctx: RouteContext, input: ClinicalSectionUpdateInput): Promise; /** * Updates one subject-owned section, including non-clinical sections such as * appointments or contracts, while preserving the indexed Composition * author/attester compatibility contract. */ updateSubjectSection(ctx: RouteContext, input: IndividualControllerSubjectSectionUpdateInput): Promise; /** * Updates the multi-section summary through a Composition-first document. * On a direct call, use the authenticated profile `actorDid` as `sender` and * the real hosted provider-tenant DID as `recipient`. */ updateClinicalSummary(ctx: RouteContext, input: ClinicalSummaryUpdateInput): Promise; /** * Reads the subject's available clinical document through * `Communication -> Subject/$summary -> FHIR Parameters`. * * The returned `BundleReader` navigates the authoritative GW document by * section. This method never ingests resources or updates the index. */ requestClinicalSummary(ctx: RouteContext, input: ClinicalSummaryRequestInput): Promise; /** * Registers one FHIR resource or raw artifact on blockchain before it is * attached to a subject communication. */ registerBlockchainArtifactAndUpdateIndex(ctx: RouteContext, input: BlockchainArtifactRegistrationInput): Promise; /** * Searches indexed communication channel records by subject and participant * identifiers. */ searchCommunicationParticipants(ctx: RouteContext, input: CommunicationParticipantRuntimeSearchInput): Promise; /** * Legacy direct Composition transfer hook. * * @deprecated Canonical twins are created only by GW from current subject * data after `setDigitalTwinSecondaryUseConsent(..., { decision: 'permit' })`. * The Node runtime intentionally does not publish canonical Compositions. */ generateDigitalTwinFromSubjectData(ctx: RouteContext, input: DigitalTwinGenerationInput): Promise; /** * Enables or disables the subject's secondary-use digital-twin projection. * This is the canonical patient-side operation; application code must not * publish a canonical Composition directly into the research index. The * caller supplies only the portal/software/study reference. GW owns and * reuses the underlying FHIR Consent identifier. */ setDigitalTwinSecondaryUseConsent(ctx: RouteContext, input: DigitalTwinSecondaryUseConsentInput): Promise; /** * Offboards the subject from the current index provider. This removes only * the private subject/twin correspondence; it never deletes anonymous twin * data already shared for research. */ purgeDigitalTwinSubjectLink(ctx: RouteContext, input: DigitalTwinSubjectLinkPurgeInput): Promise; /** * Returns the current decision for one portal, software or research study. * Consent is read through Communication -> individual `Subject/_search`; * this does not query a clinical Bundle or the twin ResearchSubject index. */ getDigitalTwinSecondaryUseConsentStatus(ctx: RouteContext, input: Readonly<{ subjectDid: string; indexProviderOrganizationDid: string; researchUseReference: string; }>): Promise>; /** * Searches indexed clinical bundles for the current subject/controller context. */ searchClinicalBundle(ctx: RouteContext, input: ClinicalBundleSearchInput): Promise; /** * Returns the latest IPS-oriented bundle for one subject. */ getLatestIps(ctx: RouteContext, input: Omit): Promise; /** * Searches subject/individual-side license seats using semantic filters. */ searchLicenses(ctx: RouteContext, input: LicenseListRuntimeSearchInput): Promise; /** * Lists subject/individual-side license seats with optional filters. */ listLicenses(ctx: RouteContext, input?: LicenseListRuntimeSearchInput): Promise; /** Adds zero-cost member seats to the selected individual organization. */ addFreeMemberLicenses(ctx: RouteContext, input: IndividualMemberLicenseAddInput): Promise; /** * Reserves one member seat for an existing FHIR v3 RoleCode contact. * ISCO professionals must use Consent without this operation. */ issueMemberInvitationLicense(ctx: RouteContext, input: IndividualMemberLicenseInvitationInput): Promise; /** Accepts, deactivates or releases one member invitation seat. */ transitionMemberLicense(ctx: RouteContext, action: '_accept' | '_deactivate' | '_release', input: IndividualMemberLicenseTransitionInput): Promise; /** * Searches commercial license offers known for the individual/family * context. */ searchLicenseOffers(ctx: RouteContext, input: LicenseOfferRuntimeSearchInput): Promise; /** * Lists commercial license offers known for the individual/family context. */ listLicenseOffers(ctx: RouteContext, input?: LicenseOfferRuntimeSearchInput): Promise; /** * Searches commercial license orders/payment projections for the * individual/family context. */ searchLicenseOrders(ctx: RouteContext, input: LicenseOrderRuntimeSearchInput): Promise; /** * Lists commercial license orders/payment projections for the * individual/family context. */ listLicenseOrders(ctx: RouteContext, input?: LicenseOrderRuntimeSearchInput): Promise; /** * Requests a SMART/OpenID token for subsequent data access flows. */ requestSmartToken(input: SmartTokenRequestInput): Promise; /** * Returns the normalized public continuity aliases that would be embedded in * the individual-controller identity VC for SMART/OpenID4VP flows. */ getIdentitySameAs(input: IndividualControllerCredentialInput): string[]; /** * Builds the canonical individual-controller identity VC used by shared * SMART VP helpers. */ getIdentityVC(input: IndividualControllerCredentialInput): Record; /** * Builds one canonical subject VC for the dependent subject managed by the * current controller, for example a child, pet, or another represented * individual. */ getSubjectVC(input: IndividualSubjectCredentialInput): Record; /** * Builds the canonical individual-controller identity VP payload used by * shared SMART/OpenID4VP helpers. */ buildIdentityVpPayload(input: IndividualControllerVpPayloadInput): Record; /** * Builds one unsigned compact VP JWT for the canonical * individual-controller identity payload. */ buildUnsignedIdentityVpJwt(input: IndividualControllerVpPayloadInput, options?: Readonly<{ nowSeconds?: number; ttlSeconds?: number; nonce?: string; }>): string; /** * Low-level escape hatch for direct submit/poll flows. */ submitAndPoll(submitPath: string, pollPath: string, payload: SubmitPayload, pollOptions?: PollOptions): Promise; }