gdc-common-utils-ts 1.14.13 → 1.14.15
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/README.md +20 -7
- package/dist/examples/communication-attached-bundle-session.d.ts +22 -0
- package/dist/examples/communication-attached-bundle-session.js +79 -0
- package/dist/examples/employee.d.ts +41 -0
- package/dist/examples/employee.js +39 -0
- package/dist/examples/index.d.ts +2 -1
- package/dist/examples/index.js +2 -1
- package/dist/examples/ips-bundle.js +3 -3
- package/dist/models/bundle.d.ts +20 -2
- package/dist/models/bundle.js +8 -1
- package/dist/models/comm.d.ts +29 -0
- package/dist/models/confidential-message.d.ts +30 -2
- package/dist/models/interoperable-claims/diagnostic-report-claims.d.ts +1 -1
- package/dist/models/interoperable-claims/diagnostic-report-claims.js +1 -1
- package/dist/utils/communication-attached-bundle-session.d.ts +191 -0
- package/dist/utils/communication-attached-bundle-session.js +542 -0
- package/dist/utils/communication-bundle-document-request.d.ts +6 -0
- package/dist/utils/communication-bundle-document-request.js +8 -0
- package/dist/utils/employee.d.ts +87 -0
- package/dist/utils/employee.js +134 -0
- package/dist/utils/fhir-search.d.ts +26 -0
- package/dist/utils/fhir-search.js +84 -0
- package/dist/utils/index.d.ts +3 -1
- package/dist/utils/index.js +3 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# gdc-common-utils-ts
|
|
2
2
|
|
|
3
|
+
Employee shared examples live in `src/examples/employee.ts`.
|
|
4
|
+
Employee pure helper functions live in `src/utils/employee.ts`.
|
|
5
|
+
|
|
6
|
+
The canonical employee contract note lives in
|
|
7
|
+
`gdc-sdk-core-ts/docs/EMPLOYEES_101.md`.
|
|
8
|
+
|
|
3
9
|
Shared TypeScript utilities for GDC client and connector code. This package provides low-level primitives for cryptography, DID/DIDComm-related helpers, and the shared models and interfaces used across SDKs.
|
|
4
10
|
|
|
5
11
|
It is intentionally not a full backend orchestration layer.
|
|
@@ -21,7 +27,14 @@ boundaries used in `gdc-common-utils-ts`.
|
|
|
21
27
|
- FHIR SearchParameter names must use canonical FHIR naming (lowercase, with `-` when defined by FHIR).
|
|
22
28
|
- Never use invented camelCase parameter names for FHIR claims/search keys (example: `Communication.part-of` is valid, `Communication.partOf` is not).
|
|
23
29
|
- Only define custom names when no canonical FHIR SearchParameter exists.
|
|
24
|
-
- `resource.meta.claims` is the canonical claims container and must be preserved across conversions/transports.
|
|
30
|
+
- `resource.meta.claims` is the canonical project-specific claims container and must be preserved across conversions/transports.
|
|
31
|
+
- `resource.meta.claims` is not part of base FHIR; it is a claims-first extension carried by FHIR-like resources in GDC contracts.
|
|
32
|
+
|
|
33
|
+
If you need the canonical explanation of how DIDComm envelope, batch body,
|
|
34
|
+
entry types, FHIR-like resources, and `resource.meta.claims` fit together,
|
|
35
|
+
read first:
|
|
36
|
+
|
|
37
|
+
- [`docs/101-COMMUNICATION_LAYERING.md`](docs/101-COMMUNICATION_LAYERING.md)
|
|
25
38
|
|
|
26
39
|
## Install
|
|
27
40
|
|
|
@@ -142,12 +155,12 @@ import { JweObject, JwtCompactParts } from 'gdc-common-utils-ts/models';
|
|
|
142
155
|
- [docs/DATASPACE_DISCOVERY_ROADMAP.md](docs/DATASPACE_DISCOVERY_ROADMAP.md)
|
|
143
156
|
- cross-repo contract for dataspace discovery semantics, EU coverage
|
|
144
157
|
inference, shared DTOs, and parameterized examples
|
|
145
|
-
- [docs/
|
|
158
|
+
- [docs/101-DATASPACE_DISCOVERY_DEFAULTS.md](docs/101-DATASPACE_DISCOVERY_DEFAULTS.md)
|
|
146
159
|
- portal/backend bootstrap guide for `defaults-only`, `default-first`, and
|
|
147
160
|
`internet-first` discovery seeding by `jurisdiction + version + networkType`
|
|
148
161
|
- [docs/consent-access-matrix-task.md](docs/consent-access-matrix-task.md)
|
|
149
162
|
- next-step design/task document for active consent aggregation, explicit deny precedence, controller views, permission-request communications, and SMART access evaluation
|
|
150
|
-
- [docs/
|
|
163
|
+
- [docs/101-IPS_BUNDLE.md](docs/101-IPS_BUNDLE.md)
|
|
151
164
|
- canonical 101 for requesting IPS, editing IPS-style bundles in `Communication.content-attachment-data`, and reading resources by section
|
|
152
165
|
|
|
153
166
|
## Dataspace Protocol And Discovery
|
|
@@ -171,7 +184,7 @@ Main entry points:
|
|
|
171
184
|
- [`src/examples/dataspace-discovery.ts`](src/examples/dataspace-discovery.ts)
|
|
172
185
|
- synthetic provider/operator examples that distinguish discovery URL from
|
|
173
186
|
derived catalog artifact URL
|
|
174
|
-
- [`docs/
|
|
187
|
+
- [`docs/101-DATASPACE_DISCOVERY_DEFAULTS.md`](docs/101-DATASPACE_DISCOVERY_DEFAULTS.md)
|
|
175
188
|
- copy/paste backend bootstrap guide for portal `default-first` rollout
|
|
176
189
|
- [`__tests__/dataspace-discovery-defaults.101.test.ts`](__tests__/dataspace-discovery-defaults.101.test.ts)
|
|
177
190
|
- executable defaults-registry examples for ICAs, hosting operators, and
|
|
@@ -261,7 +274,7 @@ The canonical API contract should live in JSDoc on exported code. The README act
|
|
|
261
274
|
- This is the preferred first scope to teach when the backend only needs subject-scoped read access.
|
|
262
275
|
- [`getOrganizationCredentialFromVpToken(...)`, `getLegalRepresentativeCredentialFromVpToken(...)`](src/utils/vp-token.ts)
|
|
263
276
|
- Extract typed VC objects from a VP token when GW/SDK flows carry canonical proof only in `vp_token`.
|
|
264
|
-
- [`docs/
|
|
277
|
+
- [`docs/101-VP_TOKEN.md`](docs/101-VP_TOKEN.md)
|
|
265
278
|
- Step-by-step guide for building the canonical compact `vp_token` string from organization and representative VCs.
|
|
266
279
|
- [`validateCommunicationResourceFhirR4(...)`](src/utils/communication-fhir-r4.ts)
|
|
267
280
|
- Validates FHIR R4 `Communication` resources.
|
|
@@ -330,9 +343,9 @@ The canonical API contract should live in JSDoc on exported code. The README act
|
|
|
330
343
|
- [`src/examples/shared.ts`](src/examples/shared.ts)
|
|
331
344
|
- Shared route contexts, controller binding fragments, and reusable helper builders.
|
|
332
345
|
- `tenantId` is modeled as an identifier-like route token (`acme-id`), not as a friendly alternate name.
|
|
333
|
-
- [`docs/
|
|
346
|
+
- [`docs/101-LIFECYCLE.md`](docs/101-LIFECYCLE.md)
|
|
334
347
|
- Copy/paste lifecycle `101` guide with semantic rules and reusable placeholders.
|
|
335
|
-
- [`docs/
|
|
348
|
+
- [`docs/101-HEALTHCARE_ROLES_I18N.md`](docs/101-HEALTHCARE_ROLES_I18N.md)
|
|
336
349
|
- Sector-aware healthcare role catalog and i18n `101` (ISCO-08 + HL7) for FE/BE onboarding.
|
|
337
350
|
|
|
338
351
|
## Documentation Naming Rules
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { BundleEntry, BundleJsonApi } from '../models/bundle';
|
|
2
|
+
/**
|
|
3
|
+
* First developer use case:
|
|
4
|
+
* - edit a Consent entry inside a Communication-attached Bundle
|
|
5
|
+
* - keep active entry in memory
|
|
6
|
+
* - serialize full Bundle to Communication.content-attachment-data on save
|
|
7
|
+
* - release active entry memory when finished
|
|
8
|
+
*/
|
|
9
|
+
export declare function buildConsentEditingCommunicationSessionExample(): {
|
|
10
|
+
communicationClaims: Record<string, unknown>;
|
|
11
|
+
bundleInMemory: BundleJsonApi<BundleEntry>;
|
|
12
|
+
};
|
|
13
|
+
/**
|
|
14
|
+
* Second developer use case:
|
|
15
|
+
* - edit MedicationStatement claims to drive a health view
|
|
16
|
+
* - keep bundle attached to Communication as base64 payload
|
|
17
|
+
* - apply save/release lifecycle consistently
|
|
18
|
+
*/
|
|
19
|
+
export declare function buildMedicationEditingCommunicationSessionExample(): {
|
|
20
|
+
communicationClaims: Record<string, unknown>;
|
|
21
|
+
bundleInMemory: BundleJsonApi<BundleEntry>;
|
|
22
|
+
};
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
// Copyright 2026 Conectate Soluciones y Aplicaciones SL under the Apache License, Version 2.0.
|
|
2
|
+
// Always create JSDoc, do not use strings inline in keys nor values, use types instead, and reuse the data test examples.
|
|
3
|
+
import { HealthcareBasicSections } from '../constants/healthcare.js';
|
|
4
|
+
import { CommunicationCategoryCodes } from '../constants/communication.js';
|
|
5
|
+
import { MedicationStatementClaim } from '../models/interoperable-claims/medication-statement-claims.js';
|
|
6
|
+
import { EXAMPLE_COMMUNICATION_IDENTIFIER, EXAMPLE_CONSENT_DATE, EXAMPLE_CONSENT_IDENTIFIER, EXAMPLE_CONSENT_PERIOD_END, EXAMPLE_CONSENT_PERIOD_START, EXAMPLE_CONSENT_PURPOSE_TREATMENT, EXAMPLE_EMAIL_PROFESSIONAL, EXAMPLE_HEALTHCARE_ACTOR_ROLE_PHYSICIAN, EXAMPLE_IPS_BUNDLE_NOTE_TEXT, EXAMPLE_MEDICATION_STATEMENT_IDENTIFIER, EXAMPLE_MEDICATION_STATEMENT_STATUS, EXAMPLE_MEDICATION_STATEMENT_TEXT, EXAMPLE_SUBJECT_DID, } from './shared.js';
|
|
7
|
+
import { CommunicationAttachedBundleSession } from '../utils/communication-attached-bundle-session.js';
|
|
8
|
+
import { setCommunicationCategory, setCommunicationIdentifier, setCommunicationSubject, setCommunicationText, } from '../claims/claims-helpers-communication.js';
|
|
9
|
+
import { setActorIdentifierList, setActorRoleList, setConsentDate, setConsentDecision, setConsentIdentifier, setConsentPeriodEnd, setConsentPeriodStart, setConsentSubject, setPurposeList, setSectionList, } from '../claims/claims-helpers-consent.js';
|
|
10
|
+
/**
|
|
11
|
+
* First developer use case:
|
|
12
|
+
* - edit a Consent entry inside a Communication-attached Bundle
|
|
13
|
+
* - keep active entry in memory
|
|
14
|
+
* - serialize full Bundle to Communication.content-attachment-data on save
|
|
15
|
+
* - release active entry memory when finished
|
|
16
|
+
*/
|
|
17
|
+
export function buildConsentEditingCommunicationSessionExample() {
|
|
18
|
+
let communicationClaims = { '@context': 'org.hl7.fhir.r4' };
|
|
19
|
+
communicationClaims = setCommunicationIdentifier(communicationClaims, EXAMPLE_COMMUNICATION_IDENTIFIER);
|
|
20
|
+
communicationClaims = setCommunicationSubject(communicationClaims, EXAMPLE_SUBJECT_DID);
|
|
21
|
+
communicationClaims = setCommunicationCategory(communicationClaims, CommunicationCategoryCodes.Notification.attributeValue);
|
|
22
|
+
communicationClaims = setCommunicationText(communicationClaims, EXAMPLE_IPS_BUNDLE_NOTE_TEXT);
|
|
23
|
+
const bundleEditor = new CommunicationAttachedBundleSession({
|
|
24
|
+
communicationClaims,
|
|
25
|
+
});
|
|
26
|
+
let consentClaims = { '@context': 'org.hl7.fhir.api' };
|
|
27
|
+
consentClaims = setConsentDecision(consentClaims, 'permit');
|
|
28
|
+
consentClaims = setConsentSubject(consentClaims, EXAMPLE_SUBJECT_DID);
|
|
29
|
+
consentClaims = setConsentIdentifier(consentClaims, EXAMPLE_CONSENT_IDENTIFIER);
|
|
30
|
+
consentClaims = setConsentDate(consentClaims, EXAMPLE_CONSENT_DATE);
|
|
31
|
+
consentClaims = setConsentPeriodStart(consentClaims, EXAMPLE_CONSENT_PERIOD_START);
|
|
32
|
+
consentClaims = setConsentPeriodEnd(consentClaims, EXAMPLE_CONSENT_PERIOD_END);
|
|
33
|
+
consentClaims = setPurposeList(consentClaims, [EXAMPLE_CONSENT_PURPOSE_TREATMENT]);
|
|
34
|
+
consentClaims = setSectionList(consentClaims, [
|
|
35
|
+
HealthcareBasicSections.AllergiesAndIntolerances.attributeValue,
|
|
36
|
+
]);
|
|
37
|
+
consentClaims = setActorIdentifierList(consentClaims, [EXAMPLE_EMAIL_PROFESSIONAL]);
|
|
38
|
+
consentClaims = setActorRoleList(consentClaims, [EXAMPLE_HEALTHCARE_ACTOR_ROLE_PHYSICIAN]);
|
|
39
|
+
bundleEditor.upsertActiveConsentEntry({
|
|
40
|
+
claims: consentClaims,
|
|
41
|
+
fullUrl: `urn:uuid:${EXAMPLE_CONSENT_IDENTIFIER}`,
|
|
42
|
+
});
|
|
43
|
+
bundleEditor.saveAndReleaseActiveEntry();
|
|
44
|
+
return {
|
|
45
|
+
communicationClaims: bundleEditor.getCommunicationClaims(),
|
|
46
|
+
bundleInMemory: bundleEditor.getBundleInMemory(),
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Second developer use case:
|
|
51
|
+
* - edit MedicationStatement claims to drive a health view
|
|
52
|
+
* - keep bundle attached to Communication as base64 payload
|
|
53
|
+
* - apply save/release lifecycle consistently
|
|
54
|
+
*/
|
|
55
|
+
export function buildMedicationEditingCommunicationSessionExample() {
|
|
56
|
+
let communicationClaims = { '@context': 'org.hl7.fhir.r4' };
|
|
57
|
+
communicationClaims = setCommunicationIdentifier(communicationClaims, EXAMPLE_COMMUNICATION_IDENTIFIER);
|
|
58
|
+
communicationClaims = setCommunicationSubject(communicationClaims, EXAMPLE_SUBJECT_DID);
|
|
59
|
+
communicationClaims = setCommunicationCategory(communicationClaims, CommunicationCategoryCodes.Reminder.attributeValue);
|
|
60
|
+
communicationClaims = setCommunicationText(communicationClaims, EXAMPLE_IPS_BUNDLE_NOTE_TEXT);
|
|
61
|
+
const bundleEditor = new CommunicationAttachedBundleSession({
|
|
62
|
+
communicationClaims,
|
|
63
|
+
});
|
|
64
|
+
bundleEditor.upsertActiveMedicationStatementEntry({
|
|
65
|
+
claims: {
|
|
66
|
+
'@context': 'org.hl7.fhir.api',
|
|
67
|
+
[MedicationStatementClaim.Identifier]: EXAMPLE_MEDICATION_STATEMENT_IDENTIFIER,
|
|
68
|
+
[MedicationStatementClaim.Subject]: EXAMPLE_SUBJECT_DID,
|
|
69
|
+
[MedicationStatementClaim.Status]: EXAMPLE_MEDICATION_STATEMENT_STATUS,
|
|
70
|
+
[MedicationStatementClaim.MedicationText]: EXAMPLE_MEDICATION_STATEMENT_TEXT,
|
|
71
|
+
},
|
|
72
|
+
fullUrl: `urn:uuid:${EXAMPLE_MEDICATION_STATEMENT_IDENTIFIER}`,
|
|
73
|
+
});
|
|
74
|
+
bundleEditor.saveAndReleaseActiveEntry();
|
|
75
|
+
return {
|
|
76
|
+
communicationClaims: bundleEditor.getCommunicationClaims(),
|
|
77
|
+
bundleInMemory: bundleEditor.getBundleInMemory(),
|
|
78
|
+
};
|
|
79
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Canonical employee directory fixture shared by docs and tests.
|
|
3
|
+
*
|
|
4
|
+
* Semantics:
|
|
5
|
+
* - `identifier` points to one technical employee profile
|
|
6
|
+
* - `email` can map to multiple active roles
|
|
7
|
+
* - a purged profile remains historically addressable by `identifier`
|
|
8
|
+
*/
|
|
9
|
+
export type ExampleEmployeeRecord = Readonly<{
|
|
10
|
+
identifier: string;
|
|
11
|
+
email: string;
|
|
12
|
+
role: string;
|
|
13
|
+
status: 'active' | 'inactive' | 'purged';
|
|
14
|
+
}>;
|
|
15
|
+
export declare const ExampleEmployeeEmails: Readonly<{
|
|
16
|
+
readonly SharedProfessional: "shared.professional@example.org";
|
|
17
|
+
}>;
|
|
18
|
+
export declare const ExampleEmployeeRoles: Readonly<{
|
|
19
|
+
readonly Controller: "ISCO-08|1120";
|
|
20
|
+
readonly Doctor: "ISCO-08|2211";
|
|
21
|
+
}>;
|
|
22
|
+
export declare const EXAMPLE_EMPLOYEE_CONTROLLER_ACTIVE: ExampleEmployeeRecord;
|
|
23
|
+
export declare const EXAMPLE_EMPLOYEE_DOCTOR_ACTIVE: ExampleEmployeeRecord;
|
|
24
|
+
export declare const EXAMPLE_EMPLOYEE_DOCTOR_PURGED_HISTORICAL: ExampleEmployeeRecord;
|
|
25
|
+
export declare const EXAMPLE_EMPLOYEE_DIRECTORY_RECORDS: readonly [Readonly<{
|
|
26
|
+
identifier: string;
|
|
27
|
+
email: string;
|
|
28
|
+
role: string;
|
|
29
|
+
status: "active" | "inactive" | "purged";
|
|
30
|
+
}>, Readonly<{
|
|
31
|
+
identifier: string;
|
|
32
|
+
email: string;
|
|
33
|
+
role: string;
|
|
34
|
+
status: "active" | "inactive" | "purged";
|
|
35
|
+
}>, Readonly<{
|
|
36
|
+
identifier: string;
|
|
37
|
+
email: string;
|
|
38
|
+
role: string;
|
|
39
|
+
status: "active" | "inactive" | "purged";
|
|
40
|
+
}>];
|
|
41
|
+
export declare function buildExampleEmployeeClaims(record: ExampleEmployeeRecord): Readonly<Record<string, string>>;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { ClaimsPersonSchemaorg } from '../constants/schemaorg.js';
|
|
2
|
+
export const ExampleEmployeeEmails = Object.freeze({
|
|
3
|
+
SharedProfessional: 'shared.professional@example.org',
|
|
4
|
+
});
|
|
5
|
+
export const ExampleEmployeeRoles = Object.freeze({
|
|
6
|
+
Controller: 'ISCO-08|1120',
|
|
7
|
+
Doctor: 'ISCO-08|2211',
|
|
8
|
+
});
|
|
9
|
+
export const EXAMPLE_EMPLOYEE_CONTROLLER_ACTIVE = Object.freeze({
|
|
10
|
+
identifier: 'urn:uuid:employee-controller-active-001',
|
|
11
|
+
email: ExampleEmployeeEmails.SharedProfessional,
|
|
12
|
+
role: ExampleEmployeeRoles.Controller,
|
|
13
|
+
status: 'active',
|
|
14
|
+
});
|
|
15
|
+
export const EXAMPLE_EMPLOYEE_DOCTOR_ACTIVE = Object.freeze({
|
|
16
|
+
identifier: 'urn:uuid:employee-doctor-active-001',
|
|
17
|
+
email: ExampleEmployeeEmails.SharedProfessional,
|
|
18
|
+
role: ExampleEmployeeRoles.Doctor,
|
|
19
|
+
status: 'active',
|
|
20
|
+
});
|
|
21
|
+
export const EXAMPLE_EMPLOYEE_DOCTOR_PURGED_HISTORICAL = Object.freeze({
|
|
22
|
+
identifier: 'urn:uuid:employee-doctor-purged-000',
|
|
23
|
+
email: ExampleEmployeeEmails.SharedProfessional,
|
|
24
|
+
role: ExampleEmployeeRoles.Doctor,
|
|
25
|
+
status: 'purged',
|
|
26
|
+
});
|
|
27
|
+
export const EXAMPLE_EMPLOYEE_DIRECTORY_RECORDS = Object.freeze([
|
|
28
|
+
EXAMPLE_EMPLOYEE_CONTROLLER_ACTIVE,
|
|
29
|
+
EXAMPLE_EMPLOYEE_DOCTOR_ACTIVE,
|
|
30
|
+
EXAMPLE_EMPLOYEE_DOCTOR_PURGED_HISTORICAL,
|
|
31
|
+
]);
|
|
32
|
+
export function buildExampleEmployeeClaims(record) {
|
|
33
|
+
return Object.freeze({
|
|
34
|
+
'@context': 'org.schema',
|
|
35
|
+
[ClaimsPersonSchemaorg.identifier]: record.identifier,
|
|
36
|
+
[ClaimsPersonSchemaorg.email]: record.email,
|
|
37
|
+
[ClaimsPersonSchemaorg.hasOccupationalRoleValue]: record.role,
|
|
38
|
+
});
|
|
39
|
+
}
|
package/dist/examples/index.d.ts
CHANGED
|
@@ -4,6 +4,7 @@ export * from './dataspace-discovery';
|
|
|
4
4
|
export * from './organization-controller';
|
|
5
5
|
export * from './individual-controller';
|
|
6
6
|
export * from './professional';
|
|
7
|
+
export * from './employee';
|
|
7
8
|
export * from './related-person';
|
|
8
9
|
export * from './consent-access';
|
|
9
10
|
export * from './relationship-access';
|
|
@@ -11,6 +12,6 @@ export * from './frontend-session';
|
|
|
11
12
|
export * from './lifecycle';
|
|
12
13
|
export * from './api-flow-examples';
|
|
13
14
|
export * from './contract-examples';
|
|
14
|
-
export * from './communication-bundle-session';
|
|
15
|
+
export * from './communication-attached-bundle-session';
|
|
15
16
|
export * from './communication-bundle-document-request';
|
|
16
17
|
export * from './ips-bundle';
|
package/dist/examples/index.js
CHANGED
|
@@ -4,6 +4,7 @@ export * from './dataspace-discovery.js';
|
|
|
4
4
|
export * from './organization-controller.js';
|
|
5
5
|
export * from './individual-controller.js';
|
|
6
6
|
export * from './professional.js';
|
|
7
|
+
export * from './employee.js';
|
|
7
8
|
export * from './related-person.js';
|
|
8
9
|
export * from './consent-access.js';
|
|
9
10
|
export * from './relationship-access.js';
|
|
@@ -11,6 +12,6 @@ export * from './frontend-session.js';
|
|
|
11
12
|
export * from './lifecycle.js';
|
|
12
13
|
export * from './api-flow-examples.js';
|
|
13
14
|
export * from './contract-examples.js';
|
|
14
|
-
export * from './communication-bundle-session.js';
|
|
15
|
+
export * from './communication-attached-bundle-session.js';
|
|
15
16
|
export * from './communication-bundle-document-request.js';
|
|
16
17
|
export * from './ips-bundle.js';
|
|
@@ -8,13 +8,13 @@ import { ConditionClaim } from '../models/interoperable-claims/condition-claims.
|
|
|
8
8
|
import { MedicationStatementClaim } from '../models/interoperable-claims/medication-statement-claims.js';
|
|
9
9
|
import { EXAMPLE_COMMUNICATION_IDENTIFIER, EXAMPLE_DOCUMENT_REFERENCE_CONTENT_TYPE_PDF, EXAMPLE_DOCUMENT_REFERENCE_DATE, EXAMPLE_DOCUMENT_REFERENCE_DESCRIPTION, EXAMPLE_DOCUMENT_REFERENCE_IDENTIFIER, EXAMPLE_DOCUMENT_REFERENCE_URL, EXAMPLE_IPS_BUNDLE_NOTE_TEXT, EXAMPLE_MEDICATION_STATEMENT_IDENTIFIER, EXAMPLE_MEDICATION_STATEMENT_STATUS, EXAMPLE_MEDICATION_STATEMENT_TEXT, EXAMPLE_SUBJECT_DID, } from './shared.js';
|
|
10
10
|
import { toClinicalResourceCardViews, toClinicalResourceCommonViews, } from '../utils/clinical-resource-view.js';
|
|
11
|
-
import {
|
|
11
|
+
import { CommunicationAttachedBundleSession } from '../utils/communication-attached-bundle-session.js';
|
|
12
12
|
/**
|
|
13
13
|
* Builds a minimal IPS-like history bundle with common clinical resource types
|
|
14
14
|
* authored as `resource.meta.claims`.
|
|
15
15
|
*/
|
|
16
16
|
export function buildIpsClinicalHistoryBundleExample() {
|
|
17
|
-
const bundleEditor = new
|
|
17
|
+
const bundleEditor = new CommunicationAttachedBundleSession({
|
|
18
18
|
communicationClaims: {
|
|
19
19
|
'@context': 'org.hl7.fhir.r4',
|
|
20
20
|
[CommunicationClaim.Identifier]: EXAMPLE_COMMUNICATION_IDENTIFIER,
|
|
@@ -81,7 +81,7 @@ export function buildIpsClinicalHistoryBundleExample() {
|
|
|
81
81
|
*/
|
|
82
82
|
export function buildIpsBundleFrontCardsExample() {
|
|
83
83
|
const { communicationClaims, bundleInMemory } = buildIpsClinicalHistoryBundleExample();
|
|
84
|
-
const bundleEditor = new
|
|
84
|
+
const bundleEditor = new CommunicationAttachedBundleSession({
|
|
85
85
|
communicationClaims,
|
|
86
86
|
initialBundle: bundleInMemory,
|
|
87
87
|
});
|
package/dist/models/bundle.d.ts
CHANGED
|
@@ -16,16 +16,28 @@
|
|
|
16
16
|
* 2. **`BundleEntry`**: The core component of a Bundle. Represents a single unit of work,
|
|
17
17
|
* such as registering one organization or creating one employee. It has a strict
|
|
18
18
|
* structure:
|
|
19
|
-
* - `type`: A string that defines the business
|
|
19
|
+
* - `type`: A string that defines the internal business/message kind
|
|
20
|
+
* (e.g., 'Organization-registration-offer-v1.0').
|
|
20
21
|
* - `resource.meta.claims`: Canonical location for claims in request entries.
|
|
21
22
|
* - `meta.claims`: Legacy compatibility location accepted during migration.
|
|
22
23
|
* - `resource`: A FHIR-like resource object that is the subject of the action.
|
|
23
24
|
* - `request`/`response`: Contextual objects indicating the operation's details or result.
|
|
25
|
+
*
|
|
26
|
+
* Important distinction:
|
|
27
|
+
* - `BundleEntry.type` is not a FHIR field
|
|
28
|
+
* - `BundleEntry.resource.resourceType` is the actual FHIR-like resource type
|
|
29
|
+
* - `BundleJsonApi.type` is the batch container type
|
|
30
|
+
* - DIDComm envelope `type` is yet another outer field
|
|
24
31
|
*/
|
|
25
32
|
import { OperationOutcome } from "./operation-outcome";
|
|
26
33
|
/**
|
|
27
34
|
* Defines the `request` property for an entry in a request Bundle.
|
|
28
35
|
* This indicates the intended action for the entry.
|
|
36
|
+
*
|
|
37
|
+
* FHIR note:
|
|
38
|
+
* - this is the closest layer to FHIR batch semantics
|
|
39
|
+
* - `request.method` and `request.url` describe the operation
|
|
40
|
+
* - `BundleEntry.type` remains a separate internal business/message label
|
|
29
41
|
*/
|
|
30
42
|
export interface BundleRequest {
|
|
31
43
|
method: 'POST' | 'PUT' | 'DELETE' | 'GET';
|
|
@@ -131,7 +143,8 @@ export interface ErrorEntry {
|
|
|
131
143
|
* Represents a single, canonical entry within a `BundleJsonApi`.
|
|
132
144
|
* This structure is used for both requests and successful responses.
|
|
133
145
|
*
|
|
134
|
-
* @property {string} type -
|
|
146
|
+
* @property {string} type - Internal business/message kind for this entry.
|
|
147
|
+
* This is not the FHIR `resourceType`.
|
|
135
148
|
* @property {object} resource - The primary FHIR-like resource that is the subject of the action.
|
|
136
149
|
* Canonical claims location is `resource.meta.claims`.
|
|
137
150
|
* @property {BundleEntryMeta} [meta] - Legacy top-level claims location for backward compatibility.
|
|
@@ -153,6 +166,11 @@ export type BundleEntry = {
|
|
|
153
166
|
* The generic type `T` allows for specifying whether the `data` array contains request
|
|
154
167
|
* entries or response entries, providing strong type safety.
|
|
155
168
|
*
|
|
169
|
+
* Layering note:
|
|
170
|
+
* - this is the business batch container
|
|
171
|
+
* - it is often placed inside the `body` of a DIDComm/FAPI envelope
|
|
172
|
+
* - entries inside it carry FHIR-like resources plus internal business labels
|
|
173
|
+
*
|
|
156
174
|
* @example
|
|
157
175
|
* const requestBundle: BundleJsonApi<BundleEntry> = { ... };
|
|
158
176
|
* const responseBundle: BundleJsonApi<BundleEntry | ErrorEntry> = { ... };
|
package/dist/models/bundle.js
CHANGED
|
@@ -16,10 +16,17 @@
|
|
|
16
16
|
* 2. **`BundleEntry`**: The core component of a Bundle. Represents a single unit of work,
|
|
17
17
|
* such as registering one organization or creating one employee. It has a strict
|
|
18
18
|
* structure:
|
|
19
|
-
* - `type`: A string that defines the business
|
|
19
|
+
* - `type`: A string that defines the internal business/message kind
|
|
20
|
+
* (e.g., 'Organization-registration-offer-v1.0').
|
|
20
21
|
* - `resource.meta.claims`: Canonical location for claims in request entries.
|
|
21
22
|
* - `meta.claims`: Legacy compatibility location accepted during migration.
|
|
22
23
|
* - `resource`: A FHIR-like resource object that is the subject of the action.
|
|
23
24
|
* - `request`/`response`: Contextual objects indicating the operation's details or result.
|
|
25
|
+
*
|
|
26
|
+
* Important distinction:
|
|
27
|
+
* - `BundleEntry.type` is not a FHIR field
|
|
28
|
+
* - `BundleEntry.resource.resourceType` is the actual FHIR-like resource type
|
|
29
|
+
* - `BundleJsonApi.type` is the batch container type
|
|
30
|
+
* - DIDComm envelope `type` is yet another outer field
|
|
24
31
|
*/
|
|
25
32
|
export {};
|
package/dist/models/comm.d.ts
CHANGED
|
@@ -1,5 +1,16 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Represents the standard payload of a DIDComm v2 message.
|
|
3
|
+
*
|
|
4
|
+
* Layering rule:
|
|
5
|
+
* - `type` here is the DIDComm/protocol envelope type
|
|
6
|
+
* - it is not the FHIR `resourceType`
|
|
7
|
+
* - it is not the internal GW batch-entry business type
|
|
8
|
+
* - `body` carries the next business layer (often a `BundleJsonApi`)
|
|
9
|
+
*
|
|
10
|
+
* Read together with:
|
|
11
|
+
* - `docs/101-COMMUNICATION_LAYERING.md`
|
|
12
|
+
* - `src/models/bundle.ts`
|
|
13
|
+
*
|
|
3
14
|
* @see https://identity.foundation/didcomm-messaging/spec/v2.0/#plaintext-message-structure
|
|
4
15
|
*/
|
|
5
16
|
export interface DidCommPayload {
|
|
@@ -18,6 +29,11 @@ export interface DidCommPayload {
|
|
|
18
29
|
/**
|
|
19
30
|
* Represents a data entry in the `body` of a CommMsgExtended,
|
|
20
31
|
* following a hybrid JSON:API and FHIR structure.
|
|
32
|
+
*
|
|
33
|
+
* Important:
|
|
34
|
+
* - `type` is an internal entry/data kind such as `Reference` or `Attachment`
|
|
35
|
+
* - it is not the DIDComm envelope type
|
|
36
|
+
* - it is not a FHIR `resourceType`
|
|
21
37
|
*/
|
|
22
38
|
export interface DataEntry {
|
|
23
39
|
id: string;
|
|
@@ -44,6 +60,19 @@ export interface DidCommAttachment {
|
|
|
44
60
|
/**
|
|
45
61
|
* The canonical, internal representation of a secure message, extending
|
|
46
62
|
* the standard DIDComm payload with FHIR-specific, flattened metadata.
|
|
63
|
+
*
|
|
64
|
+
* Intended usage:
|
|
65
|
+
* - internal GW/runtime representation
|
|
66
|
+
* - derived from FHIR-like `Communication` payloads when needed
|
|
67
|
+
*
|
|
68
|
+
* Not intended as:
|
|
69
|
+
* - the primary client-facing payload new integrators should author first
|
|
70
|
+
*
|
|
71
|
+
* New client code should usually send:
|
|
72
|
+
* - DIDComm/FAPI-style envelope
|
|
73
|
+
* - carrying a batch body
|
|
74
|
+
* - carrying FHIR-like resources such as `Communication`
|
|
75
|
+
* - with canonical business semantics in `resource.meta.claims`
|
|
47
76
|
*/
|
|
48
77
|
export interface CommMsgExtended extends DidCommPayload {
|
|
49
78
|
body: {
|
|
@@ -29,6 +29,15 @@ export interface DidCommDecodedMetadata {
|
|
|
29
29
|
* Represents the plaintext of a decoded DIDComm message.
|
|
30
30
|
* This is the core business-level "input" for a job.
|
|
31
31
|
* For FAPI compliance, this entire object is typically the payload of a signed JWS.
|
|
32
|
+
*
|
|
33
|
+
* Layering rule:
|
|
34
|
+
* - `type` is the outer envelope/protocol type
|
|
35
|
+
* - `body` carries the business payload
|
|
36
|
+
* - that `body` is often a batch container such as `BundleJsonApi`
|
|
37
|
+
* - resources inside that batch may be FHIR-like resources with
|
|
38
|
+
* `resource.meta.claims`
|
|
39
|
+
*
|
|
40
|
+
* This object is not itself a FHIR resource.
|
|
32
41
|
*/
|
|
33
42
|
export interface IDecodedDidcommPayload {
|
|
34
43
|
/** Relevant information available through the decryption and verification process */
|
|
@@ -66,10 +75,24 @@ export interface IDecodedDidcommPayload {
|
|
|
66
75
|
from?: string;
|
|
67
76
|
/**
|
|
68
77
|
* The Message Type URI, identifying the type of data in the body or protocol used.
|
|
69
|
-
*
|
|
78
|
+
*
|
|
79
|
+
* Examples:
|
|
80
|
+
* - DIDComm/business envelope type
|
|
81
|
+
* - transport protocol hint
|
|
82
|
+
*
|
|
83
|
+
* This is not:
|
|
84
|
+
* - a FHIR `resourceType`
|
|
85
|
+
* - a GW batch-entry business type
|
|
70
86
|
*/
|
|
71
87
|
type: string;
|
|
72
|
-
/**
|
|
88
|
+
/**
|
|
89
|
+
* The main business payload of the message.
|
|
90
|
+
*
|
|
91
|
+
* In GW/SDK flows this is often:
|
|
92
|
+
* - a hybrid batch container (`BundleJsonApi`)
|
|
93
|
+
* - carrying entries
|
|
94
|
+
* - carrying FHIR-like resources
|
|
95
|
+
*/
|
|
73
96
|
body: any;
|
|
74
97
|
}
|
|
75
98
|
/**
|
|
@@ -89,6 +112,11 @@ export interface CommDataEntry {
|
|
|
89
112
|
/**
|
|
90
113
|
* The canonical, internal representation of a secure message, extending
|
|
91
114
|
* the standard DIDComm payload with FHIR-specific, flattened metadata.
|
|
115
|
+
*
|
|
116
|
+
* Internal model note:
|
|
117
|
+
* - this is a gateway/runtime representation
|
|
118
|
+
* - it is not the main payload shape that new SDK/frontend/backend integrators
|
|
119
|
+
* should author directly
|
|
92
120
|
*/
|
|
93
121
|
export interface ICommPayloadExtended extends IDecodedDidcommPayload {
|
|
94
122
|
body: {
|
|
@@ -91,6 +91,6 @@ export declare const DiagnosticReportSearchParamToClaimKey: Record<DiagnosticRep
|
|
|
91
91
|
*
|
|
92
92
|
* Keep `DiagnosticReport` paused at the typing/mapping layer until:
|
|
93
93
|
* 1. `claims-helpers-diagnostic-report.ts` exists
|
|
94
|
-
* 2. `
|
|
94
|
+
* 2. `CommunicationAttachedBundleSession.upsertActiveDiagnosticReportEntry(...)` exists
|
|
95
95
|
* 3. GW Core readers/tests consume the same shared claim keys
|
|
96
96
|
*/
|
|
@@ -100,6 +100,6 @@ export const DiagnosticReportSearchParamToClaimKey = {
|
|
|
100
100
|
*
|
|
101
101
|
* Keep `DiagnosticReport` paused at the typing/mapping layer until:
|
|
102
102
|
* 1. `claims-helpers-diagnostic-report.ts` exists
|
|
103
|
-
* 2. `
|
|
103
|
+
* 2. `CommunicationAttachedBundleSession.upsertActiveDiagnosticReportEntry(...)` exists
|
|
104
104
|
* 3. GW Core readers/tests consume the same shared claim keys
|
|
105
105
|
*/
|