gdc-common-utils-ts 2.1.0 → 2.3.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.
Files changed (175) hide show
  1. package/README.md +22 -2
  2. package/dist/claims/claims-helpers-allergy-intolerance.d.ts +8 -0
  3. package/dist/claims/claims-helpers-allergy-intolerance.js +30 -12
  4. package/dist/claims/claims-helpers-condition.d.ts +8 -0
  5. package/dist/claims/claims-helpers-condition.js +30 -12
  6. package/dist/claims/claims-helpers-consent.d.ts +4 -0
  7. package/dist/claims/claims-helpers-consent.js +15 -1
  8. package/dist/claims/claims-helpers-diagnostic-report.d.ts +4 -0
  9. package/dist/claims/claims-helpers-diagnostic-report.js +17 -2
  10. package/dist/claims/claims-helpers-medication-statement.d.ts +10 -2
  11. package/dist/claims/claims-helpers-medication-statement.js +32 -14
  12. package/dist/constants/data-collections.js +0 -1
  13. package/dist/constants/didcomm.d.ts +22 -0
  14. package/dist/constants/didcomm.js +22 -0
  15. package/dist/constants/fhir-resource-types.d.ts +16 -0
  16. package/dist/constants/fhir-resource-types.js +7 -0
  17. package/dist/constants/healthcare.d.ts +348 -193
  18. package/dist/constants/healthcare.js +99 -37
  19. package/dist/constants/hl7-roles.d.ts +38 -4
  20. package/dist/constants/hl7-roles.js +92 -4
  21. package/dist/constants/index.d.ts +1 -0
  22. package/dist/constants/index.js +1 -0
  23. package/dist/constants/lifecycle.d.ts +2 -0
  24. package/dist/constants/lifecycle.js +2 -0
  25. package/dist/constants/verifiable-credentials.d.ts +9 -0
  26. package/dist/constants/verifiable-credentials.js +9 -0
  27. package/dist/examples/bundle-didcomm-payload.js +4 -2
  28. package/dist/examples/communication-attached-bundle-session.js +27 -27
  29. package/dist/examples/communication-didcomm-payload.d.ts +8 -4
  30. package/dist/examples/communication-didcomm-payload.js +17 -11
  31. package/dist/examples/consent-access.js +2 -1
  32. package/dist/examples/employee.d.ts +21 -0
  33. package/dist/examples/employee.js +21 -0
  34. package/dist/examples/individual-controller.d.ts +27 -0
  35. package/dist/examples/individual-controller.js +28 -1
  36. package/dist/examples/inter-tenant-access-contract.js +3 -2
  37. package/dist/examples/ips-bundle.js +17 -16
  38. package/dist/examples/lifecycle.js +13 -11
  39. package/dist/examples/profile-manager-mem.js +2 -1
  40. package/dist/examples/related-person.d.ts +14 -0
  41. package/dist/examples/related-person.js +18 -4
  42. package/dist/examples/shared.d.ts +12 -3
  43. package/dist/examples/shared.js +13 -4
  44. package/dist/examples/vital-signs.js +1 -1
  45. package/dist/examples/wallet-mem.js +4 -2
  46. package/dist/i18n/role-codes.i18n.d.ts +9 -1
  47. package/dist/i18n/role-codes.i18n.js +12 -1
  48. package/dist/models/authority-resolution.d.ts +56 -0
  49. package/dist/models/authority-resolution.js +2 -0
  50. package/dist/models/bundle-editor-types.d.ts +89 -0
  51. package/dist/models/bundle-editor-types.js +45 -0
  52. package/dist/models/bundle.d.ts +5 -0
  53. package/dist/models/communication-attached-bundle-session.d.ts +6 -4
  54. package/dist/models/communication-attached-bundle-session.js +6 -4
  55. package/dist/models/confidential-storage.d.ts +2 -1
  56. package/dist/models/consent-rule.d.ts +11 -1
  57. package/dist/models/consent-rule.js +9 -1
  58. package/dist/models/device-license.d.ts +20 -0
  59. package/dist/models/index.d.ts +2 -0
  60. package/dist/models/index.js +2 -0
  61. package/dist/models/individual-onboarding.d.ts +18 -0
  62. package/dist/models/interoperable-claims/allergy-intolerance-claims.d.ts +12 -1
  63. package/dist/models/interoperable-claims/allergy-intolerance-claims.js +12 -1
  64. package/dist/models/interoperable-claims/condition-claims.d.ts +12 -1
  65. package/dist/models/interoperable-claims/condition-claims.js +12 -1
  66. package/dist/models/interoperable-claims/diagnostic-report-claims.d.ts +13 -2
  67. package/dist/models/interoperable-claims/diagnostic-report-claims.js +12 -1
  68. package/dist/models/interoperable-claims/document-reference-claims.d.ts +1 -0
  69. package/dist/models/interoperable-claims/document-reference-claims.js +3 -0
  70. package/dist/models/interoperable-claims/medication-statement-claims.d.ts +17 -0
  71. package/dist/models/interoperable-claims/medication-statement-claims.js +17 -0
  72. package/dist/models/interoperable-claims/related-person-claims.d.ts +13 -0
  73. package/dist/models/interoperable-claims/related-person-claims.js +16 -0
  74. package/dist/utils/allergy-intolerance-entry-editor.d.ts +51 -0
  75. package/dist/utils/allergy-intolerance-entry-editor.js +55 -0
  76. package/dist/utils/authority-resolution.d.ts +37 -0
  77. package/dist/utils/authority-resolution.js +112 -0
  78. package/dist/utils/backend-message-manager-mem.d.ts +11 -0
  79. package/dist/utils/backend-message-manager-mem.js +11 -0
  80. package/dist/utils/bundle-didcomm-payload.js +3 -2
  81. package/dist/utils/bundle-document-builder.d.ts +36 -0
  82. package/dist/utils/bundle-document-builder.js +310 -14
  83. package/dist/utils/bundle-editor-core.d.ts +181 -0
  84. package/dist/utils/bundle-editor-core.js +467 -0
  85. package/dist/utils/bundle-editor-helpers.d.ts +53 -0
  86. package/dist/utils/bundle-editor-helpers.js +146 -0
  87. package/dist/utils/bundle-editor-registry.d.ts +6 -0
  88. package/dist/utils/bundle-editor-registry.js +14 -0
  89. package/dist/utils/bundle-editor.d.ts +21 -722
  90. package/dist/utils/bundle-editor.js +21 -1601
  91. package/dist/utils/bundle-entry-editor.d.ts +96 -0
  92. package/dist/utils/bundle-entry-editor.js +305 -0
  93. package/dist/utils/bundle-query.d.ts +1 -0
  94. package/dist/utils/bundle-query.js +12 -3
  95. package/dist/utils/bundle-reader.d.ts +48 -0
  96. package/dist/utils/bundle-reader.js +175 -1
  97. package/dist/utils/care-plan-entry-editor.d.ts +43 -0
  98. package/dist/utils/care-plan-entry-editor.js +47 -0
  99. package/dist/utils/client-assertion.d.ts +38 -0
  100. package/dist/utils/client-assertion.js +113 -0
  101. package/dist/utils/clinical-impression-entry-editor.d.ts +43 -0
  102. package/dist/utils/clinical-impression-entry-editor.js +47 -0
  103. package/dist/utils/clinical-resource-entry-editor.d.ts +123 -0
  104. package/dist/utils/clinical-resource-entry-editor.js +296 -0
  105. package/dist/utils/clinical-resource-view.d.ts +16 -0
  106. package/dist/utils/clinical-resource-view.js +267 -33
  107. package/dist/utils/communication-attached-bundle-session-helpers.js +8 -6
  108. package/dist/utils/communication-attached-bundle-session.d.ts +29 -3
  109. package/dist/utils/communication-attached-bundle-session.js +62 -3
  110. package/dist/utils/communication-consent-access-editor.d.ts +8 -4
  111. package/dist/utils/communication-consent-access-editor.js +8 -4
  112. package/dist/utils/communication-didcomm-payload.d.ts +5 -0
  113. package/dist/utils/communication-didcomm-payload.js +28 -18
  114. package/dist/utils/communication-document-reference.d.ts +23 -0
  115. package/dist/utils/communication-document-reference.js +89 -0
  116. package/dist/utils/communication-editor.d.ts +53 -0
  117. package/dist/utils/communication-editor.js +97 -0
  118. package/dist/utils/condition-entry-editor.d.ts +30 -0
  119. package/dist/utils/condition-entry-editor.js +34 -0
  120. package/dist/utils/consent-claim-helpers.d.ts +4 -0
  121. package/dist/utils/consent-claim-helpers.js +15 -1
  122. package/dist/utils/consent-duplicate-rules.js +1 -1
  123. package/dist/utils/coverage-entry-editor.d.ts +51 -0
  124. package/dist/utils/coverage-entry-editor.js +55 -0
  125. package/dist/utils/device-entry-editor.d.ts +59 -0
  126. package/dist/utils/device-entry-editor.js +63 -0
  127. package/dist/utils/device-use-statement-entry-editor.d.ts +43 -0
  128. package/dist/utils/device-use-statement-entry-editor.js +47 -0
  129. package/dist/utils/diagnostic-report-entry-editor.d.ts +74 -0
  130. package/dist/utils/diagnostic-report-entry-editor.js +136 -0
  131. package/dist/utils/did.d.ts +8 -0
  132. package/dist/utils/did.js +22 -0
  133. package/dist/utils/document-reference-entry-editor.d.ts +62 -0
  134. package/dist/utils/document-reference-entry-editor.js +66 -0
  135. package/dist/utils/employee-entry-editor.d.ts +36 -0
  136. package/dist/utils/employee-entry-editor.js +88 -0
  137. package/dist/utils/employee.d.ts +1 -0
  138. package/dist/utils/employee.js +2 -1
  139. package/dist/utils/encounter-entry-editor.d.ts +51 -0
  140. package/dist/utils/encounter-entry-editor.js +55 -0
  141. package/dist/utils/flag-entry-editor.d.ts +47 -0
  142. package/dist/utils/flag-entry-editor.js +51 -0
  143. package/dist/utils/immunization-entry-editor.d.ts +87 -0
  144. package/dist/utils/immunization-entry-editor.js +169 -0
  145. package/dist/utils/index.d.ts +7 -0
  146. package/dist/utils/index.js +7 -0
  147. package/dist/utils/individual-onboarding-acceptance-credential.d.ts +35 -0
  148. package/dist/utils/individual-onboarding-acceptance-credential.js +55 -0
  149. package/dist/utils/individual-smart.d.ts +59 -0
  150. package/dist/utils/individual-smart.js +135 -0
  151. package/dist/utils/license-list-search.d.ts +5 -0
  152. package/dist/utils/license-list-search.js +9 -0
  153. package/dist/utils/license.d.ts +45 -1
  154. package/dist/utils/license.js +86 -2
  155. package/dist/utils/medication-statement-entry-editor.d.ts +90 -0
  156. package/dist/utils/medication-statement-entry-editor.js +94 -0
  157. package/dist/utils/observation-component-entry-editor.d.ts +57 -0
  158. package/dist/utils/observation-component-entry-editor.js +105 -0
  159. package/dist/utils/observation-entry-editor.d.ts +29 -0
  160. package/dist/utils/observation-entry-editor.js +68 -0
  161. package/dist/utils/procedure-entry-editor.d.ts +71 -0
  162. package/dist/utils/procedure-entry-editor.js +75 -0
  163. package/dist/utils/professional-smart.d.ts +87 -0
  164. package/dist/utils/professional-smart.js +118 -4
  165. package/dist/utils/related-person-list.d.ts +4 -0
  166. package/dist/utils/related-person-list.js +26 -6
  167. package/dist/utils/same-as.d.ts +40 -0
  168. package/dist/utils/same-as.js +72 -0
  169. package/dist/utils/unified-health-id.d.ts +51 -0
  170. package/dist/utils/unified-health-id.js +92 -0
  171. package/dist/utils/vital-sign-day-batch.d.ts +25 -0
  172. package/dist/utils/vital-sign-day-batch.js +115 -0
  173. package/dist/utils/vital-sign-entry-editor.d.ts +61 -0
  174. package/dist/utils/vital-sign-entry-editor.js +152 -0
  175. package/package.json +2 -1
@@ -1,7 +1,9 @@
1
1
  // Copyright 2026 Antifraud Services Inc. under the Apache License, Version 2.0.
2
2
  import { ClaimsOrganizationSchemaorg, ClaimsPersonSchemaorg, } from '../constants/schemaorg.js';
3
3
  import { LifecycleRequestType } from '../constants/lifecycle.js';
4
+ import { ResourceTypesFhirR4 } from '../constants/fhir-resource-types.js';
4
5
  import { ClaimConsent } from '../models/consent-rule.js';
6
+ import { BundleEntryClaimsContext } from '../models/communication-attached-bundle-session.js';
5
7
  import { IndividualOrganizationLifecycleEditor, IndividualOrganizationLifecycleOperations, } from '../utils/individual-organization-lifecycle.js';
6
8
  import { EXAMPLE_EMAIL_CONTROLLER_INDIVIDUAL, EXAMPLE_EMAIL_CONTROLLER_ORG, EXAMPLE_CLINICAL_SECTION_ALLERGIES, EXAMPLE_CONSENT_PURPOSE_TREATMENT, EXAMPLE_HEALTHCARE_ACTOR_ROLE_PHYSICIAN, EXAMPLE_JURISDICTION, EXAMPLE_SECTOR, EXAMPLE_TENANT_IDENTIFIER, } from './shared.js';
7
9
  /**
@@ -16,8 +18,8 @@ export const EXAMPLE_LIFECYCLE_OPERATIONS = {
16
18
  disable: 'disable',
17
19
  delete: 'delete',
18
20
  };
19
- export const EXAMPLE_INDIVIDUAL_ORGANIZATION_DISABLE_REQUEST_TYPE = 'Family-disable-request-v1.0';
20
- export const EXAMPLE_INDIVIDUAL_ORGANIZATION_PURGE_REQUEST_TYPE = 'Family-purge-request-v1.0';
21
+ export const EXAMPLE_INDIVIDUAL_ORGANIZATION_DISABLE_REQUEST_TYPE = LifecycleRequestType.IndividualOrganizationDisable;
22
+ export const EXAMPLE_INDIVIDUAL_ORGANIZATION_PURGE_REQUEST_TYPE = LifecycleRequestType.IndividualOrganizationPurge;
21
23
  export const EXAMPLE_TENANT_ENABLE_REQUEST_TYPE = LifecycleRequestType.TenantEnable;
22
24
  export const EXAMPLE_TENANT_DISABLE_REQUEST_TYPE = LifecycleRequestType.TenantDisable;
23
25
  export const EXAMPLE_TENANT_PURGE_REQUEST_TYPE = LifecycleRequestType.TenantPurge;
@@ -107,7 +109,7 @@ export const EXAMPLE_EMPLOYEE_DELETE_MESSAGE = {
107
109
  };
108
110
  export const EXAMPLE_TENANT_ENABLE_MESSAGE = {
109
111
  operation: EXAMPLE_LIFECYCLE_OPERATIONS.enable,
110
- resourceType: 'Organization',
112
+ resourceType: ResourceTypesFhirR4.Organization,
111
113
  routeContext: {
112
114
  tenantId: 'host',
113
115
  jurisdiction: EXAMPLE_JURISDICTION,
@@ -122,7 +124,7 @@ export const EXAMPLE_TENANT_ENABLE_MESSAGE = {
122
124
  };
123
125
  export const EXAMPLE_TENANT_DISABLE_MESSAGE = {
124
126
  operation: EXAMPLE_LIFECYCLE_OPERATIONS.disable,
125
- resourceType: 'Organization',
127
+ resourceType: ResourceTypesFhirR4.Organization,
126
128
  routeContext: {
127
129
  tenantId: 'host',
128
130
  jurisdiction: EXAMPLE_JURISDICTION,
@@ -142,7 +144,7 @@ export const EXAMPLE_TENANT_DISABLE_MESSAGE = {
142
144
  };
143
145
  export const EXAMPLE_TENANT_DELETE_MESSAGE = {
144
146
  operation: EXAMPLE_LIFECYCLE_OPERATIONS.delete,
145
- resourceType: 'Organization',
147
+ resourceType: ResourceTypesFhirR4.Organization,
146
148
  routeContext: {
147
149
  tenantId: 'host',
148
150
  jurisdiction: EXAMPLE_JURISDICTION,
@@ -234,14 +236,14 @@ export const EXAMPLE_INDIVIDUAL_ORGANIZATION_PURGE_PAYLOAD = new IndividualOrgan
234
236
  .buildCurrentGwPayload();
235
237
  export const EXAMPLE_CONSENT_ENABLE_MESSAGE = {
236
238
  operation: EXAMPLE_LIFECYCLE_OPERATIONS.enable,
237
- resourceType: 'Consent',
239
+ resourceType: ResourceTypesFhirR4.Consent,
238
240
  routeContext: {
239
241
  tenantId: EXAMPLE_TENANT_IDENTIFIER,
240
242
  jurisdiction: EXAMPLE_JURISDICTION,
241
243
  sector: EXAMPLE_SECTOR,
242
244
  },
243
245
  claims: {
244
- '@context': 'org.hl7.fhir.api',
246
+ '@context': BundleEntryClaimsContext,
245
247
  [ClaimConsent.identifier]: EXAMPLE_LIFECYCLE_PLACEHOLDERS.consentIdentifier,
246
248
  [ClaimConsent.subject]: EXAMPLE_LIFECYCLE_PLACEHOLDERS.individualSubjectDid,
247
249
  [ClaimConsent.actorIdentifier]: EXAMPLE_LIFECYCLE_PLACEHOLDERS.consentActorIdentifier,
@@ -253,14 +255,14 @@ export const EXAMPLE_CONSENT_ENABLE_MESSAGE = {
253
255
  };
254
256
  export const EXAMPLE_CONSENT_DISABLE_MESSAGE = {
255
257
  operation: EXAMPLE_LIFECYCLE_OPERATIONS.disable,
256
- resourceType: 'Consent',
258
+ resourceType: ResourceTypesFhirR4.Consent,
257
259
  routeContext: {
258
260
  tenantId: EXAMPLE_TENANT_IDENTIFIER,
259
261
  jurisdiction: EXAMPLE_JURISDICTION,
260
262
  sector: EXAMPLE_SECTOR,
261
263
  },
262
264
  claims: {
263
- '@context': 'org.hl7.fhir.api',
265
+ '@context': BundleEntryClaimsContext,
264
266
  [ClaimConsent.identifier]: EXAMPLE_LIFECYCLE_PLACEHOLDERS.consentIdentifier,
265
267
  [ClaimConsent.subject]: EXAMPLE_LIFECYCLE_PLACEHOLDERS.individualSubjectDid,
266
268
  [ClaimConsent.actorIdentifier]: EXAMPLE_LIFECYCLE_PLACEHOLDERS.consentActorIdentifier,
@@ -272,14 +274,14 @@ export const EXAMPLE_CONSENT_DISABLE_MESSAGE = {
272
274
  };
273
275
  export const EXAMPLE_CONSENT_DELETE_MESSAGE = {
274
276
  operation: EXAMPLE_LIFECYCLE_OPERATIONS.delete,
275
- resourceType: 'Consent',
277
+ resourceType: ResourceTypesFhirR4.Consent,
276
278
  routeContext: {
277
279
  tenantId: EXAMPLE_TENANT_IDENTIFIER,
278
280
  jurisdiction: EXAMPLE_JURISDICTION,
279
281
  sector: EXAMPLE_SECTOR,
280
282
  },
281
283
  claims: {
282
- '@context': 'org.hl7.fhir.api',
284
+ '@context': BundleEntryClaimsContext,
283
285
  [ClaimConsent.identifier]: EXAMPLE_LIFECYCLE_PLACEHOLDERS.consentIdentifier,
284
286
  [ClaimConsent.subject]: EXAMPLE_LIFECYCLE_PLACEHOLDERS.individualSubjectDid,
285
287
  [ClaimConsent.actorIdentifier]: EXAMPLE_LIFECYCLE_PLACEHOLDERS.consentActorIdentifier,
@@ -1,4 +1,5 @@
1
1
  // Copyright 2026 Conectate Soluciones y Aplicaciones SL under the Apache License, Version 2.0.
2
+ import { DidcommMessageTypes } from '../constants/didcomm.js';
2
3
  import { EXAMPLE_WALLET_ENTITY_ID_RECIPIENT, EXAMPLE_WALLET_ENTITY_ID_SENDER, EXAMPLE_WALLET_MESSAGE_PAYLOAD, EXAMPLE_WALLET_PRIORITY_EMERGENCY, EXAMPLE_WALLET_PRIORITY_NORMAL, EXAMPLE_WALLET_THREAD_ID, } from './wallet-mem.js';
3
4
  /**
4
5
  * Shared synthetic fixtures for low-level profile/message-manager tests.
@@ -9,7 +10,7 @@ export const EXAMPLE_PROFILE_MANAGER_MEM_DID = 'did:web:portal.example.org';
9
10
  export const EXAMPLE_PROFILE_MANAGER_MEM_GATEWAY_DID = 'did:web:gw.example.org';
10
11
  export const EXAMPLE_PROFILE_MANAGER_MEM_DISPLAY_NAME = 'Portal BFF Profile';
11
12
  export const EXAMPLE_PROFILE_MANAGER_MEM_GATEWAY_DISPLAY_NAME = 'GW Proxy Profile';
12
- export const EXAMPLE_PROFILE_MANAGER_MEM_RESPONSE_TYPE = 'Communication-response-v1.0';
13
+ export const EXAMPLE_PROFILE_MANAGER_MEM_RESPONSE_TYPE = DidcommMessageTypes.CommunicationResponse;
13
14
  export const EXAMPLE_PROFILE_MANAGER_MEM_RESPONSE_NOTE = 'Gateway acknowledged the queued communication.';
14
15
  export const EXAMPLE_PROFILE_MANAGER_MEM_PORTAL_REPLY_AUD = 'https://portal.example.org/reply';
15
16
  export const EXAMPLE_PROFILE_MANAGER_MEM_PORTAL_INBOX_AUD = 'https://portal.example.org/inbox';
@@ -7,6 +7,20 @@ export declare const EXAMPLE_RELATED_PERSON_PURGE_REQUEST_TYPE: "RelatedPerson-p
7
7
  export declare const EXAMPLE_RELATED_PERSON_INTERNAL_RESOURCE_ID: "related-person-internal-001";
8
8
  export declare const EXAMPLE_RELATED_PERSON_SEARCH_URL: string;
9
9
  export declare const EXAMPLE_RELATED_PERSON_DISPLAY_NAME: "Jose Example";
10
+ export declare const EXAMPLE_INDIVIDUAL_MEMBER_IDENTITY: Readonly<{
11
+ readonly actorDid: string;
12
+ readonly subjectDid: string;
13
+ readonly relationship: "v3-RoleCode|RESPRSN";
14
+ readonly authorityBasis: "family-book";
15
+ readonly email: "parent.guardian@example.org";
16
+ readonly telephone: "+34000000001";
17
+ readonly credentialMaterial: `${string}#signing-key-1`;
18
+ readonly evidence: readonly [{
19
+ readonly type: readonly ["DocumentVerification"];
20
+ readonly evidenceDocument: "LibroDeFamilia";
21
+ readonly verifier: "did:web:kyc.example.org";
22
+ }];
23
+ }>;
10
24
  /**
11
25
  * Minimal semantic input used by SDK helpers to disable one subject-side
12
26
  * relationship record through the identifier-first lifecycle contract.
@@ -2,7 +2,7 @@
2
2
  import { RelatedPersonClaim } from '../models/interoperable-claims/related-person-claims.js';
3
3
  import { ResourceTypesFhirR4 } from '../constants/fhir-resource-types.js';
4
4
  import { HL7_CODING_SYSTEM_V3_ROLE_CODE } from '../constants/hl7-roles.js';
5
- import { EXAMPLE_INTEROPERABLE_CONTEXT_FHIR_API, EXAMPLE_EMAIL_RELATED_PERSON, EXAMPLE_RELATED_PERSON_ACTIVE_NAME, EXAMPLE_RELATED_PERSON_IDENTIFIER, EXAMPLE_RELATED_PERSON_INACTIVE_EMAIL, EXAMPLE_RELATED_PERSON_INACTIVE_IDENTIFIER, EXAMPLE_RELATED_PERSON_INACTIVE_NAME, EXAMPLE_RELATED_PERSON_INACTIVE_RELATIONSHIP, EXAMPLE_RELATED_PERSON_ROLE, EXAMPLE_SUBJECT_DID, } from './shared.js';
5
+ import { EXAMPLE_INTEROPERABLE_CONTEXT_FHIR_API, EXAMPLE_EMAIL_RELATED_PERSON, EXAMPLE_FORM_CONTROLLER_PHONE, EXAMPLE_RELATED_PERSON_MEMBER_DID, EXAMPLE_RELATED_PERSON_ACTIVE_NAME, EXAMPLE_RELATED_PERSON_IDENTIFIER, EXAMPLE_RELATED_PERSON_INACTIVE_EMAIL, EXAMPLE_RELATED_PERSON_INACTIVE_IDENTIFIER, EXAMPLE_RELATED_PERSON_INACTIVE_NAME, EXAMPLE_RELATED_PERSON_INACTIVE_RELATIONSHIP, EXAMPLE_RELATED_PERSON_ROLE, EXAMPLE_SUBJECT_DID, } from './shared.js';
6
6
  import { createInteroperableResourceOperationEditor, InteroperableOperationMethods, buildInteroperableSearchPath, InteroperableLifecycleStatuses, } from '../utils/interoperable-resource-operation.js';
7
7
  import { LifecycleRequestType } from '../constants/lifecycle.js';
8
8
  /**
@@ -14,6 +14,20 @@ export const EXAMPLE_RELATED_PERSON_PURGE_REQUEST_TYPE = LifecycleRequestType.Re
14
14
  export const EXAMPLE_RELATED_PERSON_INTERNAL_RESOURCE_ID = 'related-person-internal-001';
15
15
  export const EXAMPLE_RELATED_PERSON_SEARCH_URL = buildInteroperableSearchPath(EXAMPLE_RELATED_PERSON_RESOURCE_TYPE);
16
16
  export const EXAMPLE_RELATED_PERSON_DISPLAY_NAME = EXAMPLE_RELATED_PERSON_ACTIVE_NAME;
17
+ export const EXAMPLE_INDIVIDUAL_MEMBER_IDENTITY = Object.freeze({
18
+ actorDid: EXAMPLE_RELATED_PERSON_MEMBER_DID,
19
+ subjectDid: EXAMPLE_SUBJECT_DID,
20
+ relationship: EXAMPLE_RELATED_PERSON_ROLE,
21
+ authorityBasis: 'family-book',
22
+ email: EXAMPLE_EMAIL_RELATED_PERSON,
23
+ telephone: EXAMPLE_FORM_CONTROLLER_PHONE,
24
+ credentialMaterial: `${EXAMPLE_RELATED_PERSON_MEMBER_DID}#signing-key-1`,
25
+ evidence: [{
26
+ type: ['DocumentVerification'],
27
+ evidenceDocument: 'LibroDeFamilia',
28
+ verifier: 'did:web:kyc.example.org',
29
+ }],
30
+ });
17
31
  /**
18
32
  * Minimal semantic input used by SDK helpers to disable one subject-side
19
33
  * relationship record through the identifier-first lifecycle contract.
@@ -59,7 +73,7 @@ export const EXAMPLE_RELATED_PERSON_DISABLE_BUNDLE_ENTRY = {
59
73
  export const EXAMPLE_RELATED_PERSON_DISABLE_BUNDLE_PAYLOAD = {
60
74
  thid: 'relatedperson-disable-example-001',
61
75
  body: {
62
- resourceType: 'Bundle',
76
+ resourceType: ResourceTypesFhirR4.Bundle,
63
77
  type: 'batch',
64
78
  entry: [EXAMPLE_RELATED_PERSON_DISABLE_BUNDLE_ENTRY],
65
79
  },
@@ -83,7 +97,7 @@ export const EXAMPLE_RELATED_PERSON_PURGE_BUNDLE_ENTRY = {
83
97
  export const EXAMPLE_RELATED_PERSON_PURGE_BUNDLE_PAYLOAD = {
84
98
  thid: 'relatedperson-purge-example-001',
85
99
  body: {
86
- resourceType: 'Bundle',
100
+ resourceType: ResourceTypesFhirR4.Bundle,
87
101
  type: 'batch',
88
102
  entry: [EXAMPLE_RELATED_PERSON_PURGE_BUNDLE_ENTRY],
89
103
  },
@@ -98,7 +112,7 @@ export const EXAMPLE_RELATED_PERSON_PURGE_BUNDLE_PAYLOAD = {
98
112
  export const EXAMPLE_RELATED_PERSON_UPSERT_BUNDLE_PAYLOAD = {
99
113
  thid: 'relatedperson-upsert-example-001',
100
114
  body: {
101
- resourceType: 'Bundle',
115
+ resourceType: ResourceTypesFhirR4.Bundle,
102
116
  type: 'batch',
103
117
  entry: [{
104
118
  resource: {
@@ -217,17 +217,20 @@ export declare const EXAMPLE_CONTENT_TYPE_FHIR_JSON: "application/fhir+json";
217
217
  export declare const EXAMPLE_IPS_BUNDLE_ATTACHMENT_TITLE: "IPS Document Bundle";
218
218
  export declare const EXAMPLE_BUNDLE_RESOURCE_TYPE: "Bundle";
219
219
  export declare const EXAMPLE_BUNDLE_TYPE_BATCH: "batch";
220
+ export declare const EXAMPLE_BUNDLE_TYPE_DOCUMENT: "document";
220
221
  export declare const EXAMPLE_MEDICATION_STATEMENT_UUID: "urn:uuid:medication-statement-example-001";
221
222
  export declare const EXAMPLE_MEDICATION_STATEMENT_IDENTIFIER: "urn:uuid:medication-statement-example-001";
222
223
  export declare const EXAMPLE_MEDICATION_STATEMENT_STATUS: "active";
223
224
  export declare const EXAMPLE_MEDICATION_STATEMENT_CODE: "http://www.nlm.nih.gov/research/umls/rxnorm|313782";
224
225
  export declare const EXAMPLE_MEDICATION_STATEMENT_TEXT: "atorvastatin 20 mg oral tablet";
226
+ export declare const EXAMPLE_MEDICATION_STATEMENT_TEXT_CORRECTED: "atorvastatin 20 mg oral tablet - corrected text";
225
227
  export declare const EXAMPLE_DOCUMENT_REFERENCE_IDENTIFIER: "docref-example-001";
226
228
  export declare const EXAMPLE_DOCUMENT_REFERENCE_IDENTIFIER_SECONDARY: "docref-example-002";
227
229
  export declare const EXAMPLE_DOCUMENT_REFERENCE_CONTENT_TYPE_PDF: "application/pdf";
228
230
  export declare const EXAMPLE_DOCUMENT_REFERENCE_URL: "https://example.org/prescription.pdf";
229
231
  export declare const EXAMPLE_DOCUMENT_REFERENCE_DESCRIPTION: "Prescription PDF";
230
232
  export declare const EXAMPLE_DOCUMENT_REFERENCE_DATE: "2026-06-12T10:00:00Z";
233
+ export declare const EXAMPLE_DOCUMENT_REFERENCE_DATA_BASE64: string;
231
234
  export declare const EXAMPLE_CLINICAL_EVENT_DATE_TIME: "2026-06-01T10:00:00Z";
232
235
  export declare const EXAMPLE_VITAL_SIGNS_EFFECTIVE_DATE_TIME: "2026-06-11T08:30:00Z";
233
236
  export declare const EXAMPLE_VITAL_SIGNS_PANEL_DATE_TIME: "2026-06-11T09:00:00Z";
@@ -239,6 +242,11 @@ export declare const EXAMPLE_VAULT_QUATERNARY_DATE_TIME: "2026-06-11T13:00:00Z";
239
242
  export declare const EXAMPLE_VAULT_CONDITION_DATE_TIME: "2026-06-11T14:00:00Z";
240
243
  export declare const EXAMPLE_DOCUMENT_REFERENCE_CONTENT_HASH: "z-document-reference-example-hash";
241
244
  export declare const EXAMPLE_DOCUMENT_REFERENCE_LANGUAGE: "en";
245
+ export declare const EXAMPLE_COMPOSITION_IDENTIFIER_MEDICATION_DOCUMENT: "urn:uuid:composition-medication-document-001";
246
+ export declare const EXAMPLE_COMPOSITION_TITLE_MEDICATION_DOCUMENT: "Medication document authored from the self-managed frontend";
247
+ export declare const EXAMPLE_COMPOSITION_DATE_MEDICATION_DOCUMENT: "2026-07-06T10:15:00Z";
248
+ export declare const EXAMPLE_COMMUNICATION_TOPIC_MEDICATION_DOCUMENT: "medication-document";
249
+ export declare const EXAMPLE_COMMUNICATION_TEXT_MEDICATION_DOCUMENT_READY: "One corrected medication document ready to travel.";
242
250
  export declare const EXAMPLE_CONSENT_ATTACHMENT_CONTENT_TYPE: "application/pdf";
243
251
  export declare const EXAMPLE_CONSENT_ATTACHMENT_DATA_BASE64: "JVBERi0xLjQKJUZha2UgY29uc2VudCBQREYgZm9yIGxvY2FsIHNtb2tlIHRlc3QK";
244
252
  export declare const EXAMPLE_CONTENT_ADDRESSED_CONSENT_IDENTIFIER: "zQmYwAPJzv5CZsnAzt8auVZRnGi2C31WnH8D9N6A7h7vY2";
@@ -607,7 +615,7 @@ export declare function buildExampleCommunicationIngestionPayload({ subjectDid,
607
615
  export declare function buildExampleDocumentReferenceSearchPayload(subjectDid?: string): {
608
616
  thid: string;
609
617
  body: {
610
- resourceType: string;
618
+ resourceType: "Bundle";
611
619
  type: string;
612
620
  entry: {
613
621
  request: {
@@ -623,8 +631,9 @@ export declare function buildExampleLiveMedicationCases(seed?: number): ExampleL
623
631
  * Builds a minimal IPS `Bundle.type=document` containing one
624
632
  * `MedicationStatement` under the `History of medication use` section.
625
633
  *
626
- * This helper exists so live GW tests and demos do not handcraft one-off
627
- * bundle structures inline.
634
+ * This is a shared fixture/secondary setup helper for transport demos and
635
+ * tests. The canonical step-by-step authoring walkthrough lives in the IPS
636
+ * bundle-editor tests, not here.
628
637
  */
629
638
  export declare function buildExampleMedicationIpsDocumentBundle(input: ExampleMedicationIpsDocumentBundleInput): ExampleMedicationIpsDocumentBundle;
630
639
  export type ExampleHostedTenantRouteContext = Readonly<{
@@ -260,17 +260,20 @@ export const EXAMPLE_CONTENT_TYPE_FHIR_JSON = 'application/fhir+json';
260
260
  export const EXAMPLE_IPS_BUNDLE_ATTACHMENT_TITLE = 'IPS Document Bundle';
261
261
  export const EXAMPLE_BUNDLE_RESOURCE_TYPE = 'Bundle';
262
262
  export const EXAMPLE_BUNDLE_TYPE_BATCH = 'batch';
263
+ export const EXAMPLE_BUNDLE_TYPE_DOCUMENT = 'document';
263
264
  export const EXAMPLE_MEDICATION_STATEMENT_UUID = 'urn:uuid:medication-statement-example-001';
264
265
  export const EXAMPLE_MEDICATION_STATEMENT_IDENTIFIER = EXAMPLE_MEDICATION_STATEMENT_UUID;
265
266
  export const EXAMPLE_MEDICATION_STATEMENT_STATUS = 'active';
266
267
  export const EXAMPLE_MEDICATION_STATEMENT_CODE = 'http://www.nlm.nih.gov/research/umls/rxnorm|313782';
267
268
  export const EXAMPLE_MEDICATION_STATEMENT_TEXT = 'atorvastatin 20 mg oral tablet';
269
+ export const EXAMPLE_MEDICATION_STATEMENT_TEXT_CORRECTED = 'atorvastatin 20 mg oral tablet - corrected text';
268
270
  export const EXAMPLE_DOCUMENT_REFERENCE_IDENTIFIER = 'docref-example-001';
269
271
  export const EXAMPLE_DOCUMENT_REFERENCE_IDENTIFIER_SECONDARY = 'docref-example-002';
270
272
  export const EXAMPLE_DOCUMENT_REFERENCE_CONTENT_TYPE_PDF = 'application/pdf';
271
273
  export const EXAMPLE_DOCUMENT_REFERENCE_URL = 'https://example.org/prescription.pdf';
272
274
  export const EXAMPLE_DOCUMENT_REFERENCE_DESCRIPTION = 'Prescription PDF';
273
275
  export const EXAMPLE_DOCUMENT_REFERENCE_DATE = '2026-06-12T10:00:00Z';
276
+ export const EXAMPLE_DOCUMENT_REFERENCE_DATA_BASE64 = Buffer.from('example-medication-leaflet', 'utf8').toString('base64');
274
277
  export const EXAMPLE_CLINICAL_EVENT_DATE_TIME = '2026-06-01T10:00:00Z';
275
278
  export const EXAMPLE_VITAL_SIGNS_EFFECTIVE_DATE_TIME = '2026-06-11T08:30:00Z';
276
279
  export const EXAMPLE_VITAL_SIGNS_PANEL_DATE_TIME = '2026-06-11T09:00:00Z';
@@ -282,6 +285,11 @@ export const EXAMPLE_VAULT_QUATERNARY_DATE_TIME = '2026-06-11T13:00:00Z';
282
285
  export const EXAMPLE_VAULT_CONDITION_DATE_TIME = '2026-06-11T14:00:00Z';
283
286
  export const EXAMPLE_DOCUMENT_REFERENCE_CONTENT_HASH = 'z-document-reference-example-hash';
284
287
  export const EXAMPLE_DOCUMENT_REFERENCE_LANGUAGE = 'en';
288
+ export const EXAMPLE_COMPOSITION_IDENTIFIER_MEDICATION_DOCUMENT = 'urn:uuid:composition-medication-document-001';
289
+ export const EXAMPLE_COMPOSITION_TITLE_MEDICATION_DOCUMENT = 'Medication document authored from the self-managed frontend';
290
+ export const EXAMPLE_COMPOSITION_DATE_MEDICATION_DOCUMENT = '2026-07-06T10:15:00Z';
291
+ export const EXAMPLE_COMMUNICATION_TOPIC_MEDICATION_DOCUMENT = 'medication-document';
292
+ export const EXAMPLE_COMMUNICATION_TEXT_MEDICATION_DOCUMENT_READY = 'One corrected medication document ready to travel.';
285
293
  export const EXAMPLE_CONSENT_ATTACHMENT_CONTENT_TYPE = EXAMPLE_DOCUMENT_REFERENCE_CONTENT_TYPE_PDF;
286
294
  export const EXAMPLE_CONSENT_ATTACHMENT_DATA_BASE64 = 'JVBERi0xLjQKJUZha2UgY29uc2VudCBQREYgZm9yIGxvY2FsIHNtb2tlIHRlc3QK';
287
295
  export const EXAMPLE_CONTENT_ADDRESSED_CONSENT_IDENTIFIER = 'zQmYwAPJzv5CZsnAzt8auVZRnGi2C31WnH8D9N6A7h7vY2';
@@ -590,7 +598,7 @@ export function buildExampleDocumentReferenceSearchPayload(subjectDid = EXAMPLE_
590
598
  return {
591
599
  thid: 'search-documentreference-example',
592
600
  body: {
593
- resourceType: 'Bundle',
601
+ resourceType: ResourceTypesFhirR4.Bundle,
594
602
  type: 'batch',
595
603
  entry: [
596
604
  {
@@ -640,8 +648,9 @@ export function buildExampleLiveMedicationCases(seed = Date.now()) {
640
648
  * Builds a minimal IPS `Bundle.type=document` containing one
641
649
  * `MedicationStatement` under the `History of medication use` section.
642
650
  *
643
- * This helper exists so live GW tests and demos do not handcraft one-off
644
- * bundle structures inline.
651
+ * This is a shared fixture/secondary setup helper for transport demos and
652
+ * tests. The canonical step-by-step authoring walkthrough lives in the IPS
653
+ * bundle-editor tests, not here.
645
654
  */
646
655
  export function buildExampleMedicationIpsDocumentBundle(input) {
647
656
  const subjectDid = input.subjectDid || EXAMPLE_SUBJECT_DID;
@@ -702,7 +711,7 @@ export function buildExampleMedicationIpsDocumentBundle(input) {
702
711
  },
703
712
  {
704
713
  resource: {
705
- resourceType: 'Patient',
714
+ resourceType: ResourceTypesFhirR4.Patient,
706
715
  id: `patient-${input.medication.identifier}`,
707
716
  },
708
717
  },
@@ -115,7 +115,7 @@ export function buildVitalSignObservationEntry(input) {
115
115
  */
116
116
  export function buildExampleVitalSignsObservationBundle() {
117
117
  return {
118
- resourceType: 'Bundle',
118
+ resourceType: ResourceTypesFhirR4.Bundle,
119
119
  type: 'collection',
120
120
  data: [
121
121
  buildVitalSignObservationEntry(EXAMPLE_VITAL_SIGN_HEART_RATE_INPUT),
@@ -1,4 +1,6 @@
1
1
  // Copyright 2026 Conectate Soluciones y Aplicaciones SL under the Apache License, Version 2.0.
2
+ import { DidcommMessageTypes } from '../constants/didcomm.js';
3
+ import { ResourceTypesFhirR4 } from '../constants/fhir-resource-types.js';
2
4
  import { WalletMessagePriorities } from '../models/wallet.js';
3
5
  /**
4
6
  * Reusable synthetic wallet fixtures for docs and tests.
@@ -12,7 +14,7 @@ export const EXAMPLE_WALLET_ENTITY_ID_RECIPIENT = 'wallet-entity-recipient-001';
12
14
  export const EXAMPLE_WALLET_MESSAGE_ID_EMERGENCY = 'wallet-message-emergency-001';
13
15
  export const EXAMPLE_WALLET_MESSAGE_ID_NORMAL = 'wallet-message-normal-001';
14
16
  export const EXAMPLE_WALLET_THREAD_ID = 'wallet-thread-001';
15
- export const EXAMPLE_WALLET_PAYLOAD_TYPE = 'Communication-bundle-submit-v1.0';
17
+ export const EXAMPLE_WALLET_PAYLOAD_TYPE = DidcommMessageTypes.CommunicationBundleSubmit;
16
18
  export const EXAMPLE_WALLET_CREATED_AT = '2026-06-30T10:00:00.000Z';
17
19
  export const EXAMPLE_WALLET_CONTENT_NOTE = 'Medication bundle ready for DIDComm transport.';
18
20
  export const EXAMPLE_WALLET_FAILURE_MESSAGE = 'Gateway temporary failure.';
@@ -31,7 +33,7 @@ export const EXAMPLE_WALLET_MESSAGE_PAYLOAD = {
31
33
  id: 'wallet-entry-001',
32
34
  type: EXAMPLE_WALLET_PAYLOAD_TYPE,
33
35
  resource: {
34
- resourceType: 'Communication',
36
+ resourceType: ResourceTypesFhirR4.Communication,
35
37
  note: [{ text: EXAMPLE_WALLET_CONTENT_NOTE }],
36
38
  },
37
39
  },
@@ -1,4 +1,12 @@
1
- export type RoleCodeI18nKey = `org.ilo.isco-08.${string}` | `org.isco08.${string}` | `org.hl7.v3.personalRelationship.${string}` | `org.hl7.v3.roleCode.${string}`;
1
+ export type RoleCodeI18nKey = `org.ilo.isco-08.${string}` | `org.isco08.${string}` | `org.hl7.terminology.CodeSystem.v3-RoleCode.${string}`
2
+ /**
3
+ * @deprecated Use `org.hl7.terminology.CodeSystem.v3-RoleCode.<code>`.
4
+ */
5
+ | `org.hl7.v3.personalRelationship.${string}`
6
+ /**
7
+ * @deprecated Use `org.hl7.terminology.CodeSystem.v3-RoleCode.<code>`.
8
+ */
9
+ | `org.hl7.v3.roleCode.${string}`;
2
10
  export type RoleCodeI18nMap = Readonly<Record<RoleCodeI18nKey, string>>;
3
11
  export declare const roleCodeI18nEn: Readonly<Record<RoleCodeI18nKey, string>>;
4
12
  export declare const healthcareRoleI18nEn: Readonly<Record<RoleCodeI18nKey, string>>;
@@ -6,7 +6,18 @@ function buildRoleCodeI18nMap() {
6
6
  const legacyIscoAliases = baseEntries
7
7
  .filter(([key]) => key.startsWith('org.ilo.isco-08.'))
8
8
  .map(([key, label]) => [key.replace('org.ilo.isco-08.', 'org.isco08.'), label]);
9
- const entries = [...baseEntries, ...legacyIscoAliases];
9
+ const legacyHl7Aliases = baseEntries
10
+ .filter(([key]) => key.startsWith('org.hl7.terminology.CodeSystem.v3-RoleCode.'))
11
+ .flatMap(([key, label]) => {
12
+ const suffix = key.replace('org.hl7.terminology.CodeSystem.v3-RoleCode.', '');
13
+ return [
14
+ /** @deprecated Compatibility alias for older consumers. */
15
+ [`org.hl7.v3.personalRelationship.${suffix}`, label],
16
+ /** @deprecated Compatibility alias for older consumers. */
17
+ [`org.hl7.v3.roleCode.${suffix}`, label],
18
+ ];
19
+ });
20
+ const entries = [...baseEntries, ...legacyIscoAliases, ...legacyHl7Aliases];
10
21
  return Object.freeze(Object.fromEntries(entries));
11
22
  }
12
23
  export const roleCodeI18nEn = buildRoleCodeI18nMap();
@@ -0,0 +1,56 @@
1
+ export type AuthorityResolutionSource = 'catalog' | 'metadata' | 'cache' | 'legacy';
2
+ export type AuthorityResolutionMatch = 'tenant-context' | 'subject-did' | 'subject-same-as' | 'authority-did' | 'authority-base-url';
3
+ /**
4
+ * Runtime-neutral request shape used to resolve which authority/host is
5
+ * responsible for one tenant or subject identifier.
6
+ *
7
+ * Design rule:
8
+ * - business callers should prefer `tenantId + jurisdiction + sector`
9
+ * - callers may additionally provide `subjectDid` or `subjectSameAs` when that
10
+ * is the only identifier already known
11
+ * - `authorityDidWeb` and `authorityBaseUrl` are optional technical hints, not
12
+ * the preferred business inputs
13
+ */
14
+ export type AuthorityResolutionInput = Readonly<{
15
+ tenantId?: string;
16
+ jurisdiction?: string;
17
+ sector?: string;
18
+ version?: string;
19
+ subjectDid?: string;
20
+ subjectSameAs?: string;
21
+ authorityDidWeb?: string;
22
+ authorityBaseUrl?: string;
23
+ metadataUrl?: string;
24
+ }>;
25
+ /**
26
+ * One published or preloaded authority catalog entry.
27
+ *
28
+ * The current minimal contract is intentionally small:
29
+ * - enough to route to one host/ICA quickly
30
+ * - enough to derive the hosted tenant DID when tenant context is known
31
+ * - enough to match by public subject alias prefixes in future registries
32
+ */
33
+ export type AuthorityCatalogRecord = Readonly<{
34
+ authorityDidWeb: string;
35
+ authorityBaseUrl?: string;
36
+ tenantDidWeb?: string;
37
+ tenantId?: string;
38
+ jurisdiction?: string;
39
+ version?: string;
40
+ sector?: string;
41
+ metadataUrl?: string;
42
+ subjectDidPrefixes?: readonly string[];
43
+ subjectSameAsPrefixes?: readonly string[];
44
+ }>;
45
+ /**
46
+ * Normalized authority resolution output returned by shared discovery helpers.
47
+ */
48
+ export type AuthorityResolution = Readonly<{
49
+ authorityDidWeb: string;
50
+ authorityBaseUrl?: string;
51
+ tenantDidWeb?: string;
52
+ metadataUrl?: string;
53
+ source: AuthorityResolutionSource;
54
+ matchedBy: AuthorityResolutionMatch;
55
+ record?: AuthorityCatalogRecord;
56
+ }>;
@@ -0,0 +1,2 @@
1
+ // Copyright 2026 Antifraud Services Inc. under the Apache License, Version 2.0.
2
+ export {};
@@ -0,0 +1,89 @@
1
+ import { type BundleEntry, type BundleJsonApi, type BundleRequest } from './bundle';
2
+ import { EmployeeBundleOperations, type EmployeeClaims } from '../utils/employee';
3
+ import type { BundleEntryEditor } from '../utils/bundle-entry-editor';
4
+ import type { EmployeeEntryEditor } from '../utils/employee-entry-editor';
5
+ import type { VitalSignEntryEditor } from '../utils/vital-sign-entry-editor';
6
+ import type { ObservationEntryEditor } from '../utils/observation-entry-editor';
7
+ import type { AllergyIntoleranceEntryEditor } from '../utils/allergy-intolerance-entry-editor';
8
+ import type { ConditionEntryEditor } from '../utils/condition-entry-editor';
9
+ import type { MedicationStatementEntryEditor } from '../utils/medication-statement-entry-editor';
10
+ import type { DocumentReferenceEntryEditor } from '../utils/document-reference-entry-editor';
11
+ import type { CarePlanEntryEditor } from '../utils/care-plan-entry-editor';
12
+ import type { FlagEntryEditor } from '../utils/flag-entry-editor';
13
+ import type { ClinicalImpressionEntryEditor } from '../utils/clinical-impression-entry-editor';
14
+ import type { DeviceEntryEditor } from '../utils/device-entry-editor';
15
+ import type { DeviceUseStatementEntryEditor } from '../utils/device-use-statement-entry-editor';
16
+ import type { EncounterEntryEditor } from '../utils/encounter-entry-editor';
17
+ import type { CoverageEntryEditor } from '../utils/coverage-entry-editor';
18
+ import type { ImmunizationEntryEditor } from '../utils/immunization-entry-editor';
19
+ import type { ProcedureEntryEditor } from '../utils/procedure-entry-editor';
20
+ import type { DiagnosticReportEntryEditor } from '../utils/diagnostic-report-entry-editor';
21
+ export type BundleOperation = (typeof EmployeeBundleOperations)[keyof typeof EmployeeBundleOperations];
22
+ /** Resource types that the shared bundle editors currently know how to open as typed entry editors. */
23
+ export declare const BundleEditableResourceTypes: Readonly<{
24
+ readonly employee: "Employee";
25
+ readonly consent: "Consent";
26
+ readonly observation: "Observation";
27
+ readonly vitalSign: "Observation";
28
+ readonly allergyIntolerance: "AllergyIntolerance";
29
+ readonly condition: "Condition";
30
+ readonly medicationStatement: "MedicationStatement";
31
+ readonly documentReference: "DocumentReference";
32
+ readonly carePlan: "CarePlan";
33
+ readonly flag: "Flag";
34
+ readonly clinicalImpression: "ClinicalImpression";
35
+ readonly device: "Device";
36
+ readonly deviceUseStatement: "DeviceUseStatement";
37
+ readonly encounter: "Encounter";
38
+ readonly coverage: "Coverage";
39
+ readonly immunization: "Immunization";
40
+ readonly procedure: "Procedure";
41
+ readonly diagnosticReport: "DiagnosticReport";
42
+ }>;
43
+ export type AllowedResourceType = string;
44
+ /** Mutable staged entry shape kept inside `BundleEditor` before final materialization. */
45
+ export type BuiltBundleEntry = {
46
+ type: string;
47
+ request: {
48
+ method: BundleRequest['method'];
49
+ url?: string;
50
+ };
51
+ resource: {
52
+ resourceType: string;
53
+ id?: string;
54
+ meta: {
55
+ claims: EmployeeClaims;
56
+ };
57
+ [key: string]: unknown;
58
+ };
59
+ fullUrl?: string;
60
+ };
61
+ export declare const BundleTypes: Readonly<{
62
+ readonly batch: "batch";
63
+ readonly document: "document";
64
+ readonly collection: "collection";
65
+ readonly transaction: "transaction";
66
+ }>;
67
+ export type BundleType = (typeof BundleTypes)[keyof typeof BundleTypes];
68
+ /** Canonical validation issues returned by `BundleEditor.validateDocumentAuthoring()`. */
69
+ export declare const BundleEditorValidationIssues: Readonly<{
70
+ readonly DocumentModeRequired: "BundleEditor must be in document mode before document validation.";
71
+ readonly CompositionSubjectRequired: "Composition.subject is required before document transport.";
72
+ readonly CompositionTypeRequired: "Composition.type is required before document transport.";
73
+ readonly CompositionTitleRequired: "Composition.title is required before document transport.";
74
+ readonly CompositionDateRequired: "Composition.date is required before document transport.";
75
+ readonly CompositionAuthorRequired: "Composition.author is required before document transport.";
76
+ readonly DocumentEntryRequired: "Bundle.document requires at least one staged resource entry.";
77
+ }>;
78
+ export type BundleEditorValidationIssue = typeof BundleEditorValidationIssues[keyof typeof BundleEditorValidationIssues];
79
+ /** Convenience alias for the in-memory JSON-API-like bundle shape returned by `buildJsonApi()`. */
80
+ export type BundleJsonApiShape = BundleJsonApi<BundleEntry>;
81
+ /**
82
+ * Type-level mapping from `BundleEditableResourceTypes.*` to the concrete
83
+ * editor class returned by `newEntryAs(...)` / `newContainedResourceAs(...)`.
84
+ *
85
+ * This exists so callers get the correct chainable editor surface from the
86
+ * resource type they requested, instead of falling back to the generic
87
+ * `BundleEntryEditor` API.
88
+ */
89
+ export type ResourceTypeEntryEditor<T extends AllowedResourceType> = T extends typeof BundleEditableResourceTypes.employee ? EmployeeEntryEditor : T extends typeof BundleEditableResourceTypes.vitalSign ? VitalSignEntryEditor : T extends typeof BundleEditableResourceTypes.observation ? ObservationEntryEditor : T extends typeof BundleEditableResourceTypes.allergyIntolerance ? AllergyIntoleranceEntryEditor : T extends typeof BundleEditableResourceTypes.condition ? ConditionEntryEditor : T extends typeof BundleEditableResourceTypes.medicationStatement ? MedicationStatementEntryEditor : T extends typeof BundleEditableResourceTypes.documentReference ? DocumentReferenceEntryEditor : T extends typeof BundleEditableResourceTypes.carePlan ? CarePlanEntryEditor : T extends typeof BundleEditableResourceTypes.flag ? FlagEntryEditor : T extends typeof BundleEditableResourceTypes.clinicalImpression ? ClinicalImpressionEntryEditor : T extends typeof BundleEditableResourceTypes.device ? DeviceEntryEditor : T extends typeof BundleEditableResourceTypes.deviceUseStatement ? DeviceUseStatementEntryEditor : T extends typeof BundleEditableResourceTypes.encounter ? EncounterEntryEditor : T extends typeof BundleEditableResourceTypes.coverage ? CoverageEntryEditor : T extends typeof BundleEditableResourceTypes.immunization ? ImmunizationEntryEditor : T extends typeof BundleEditableResourceTypes.procedure ? ProcedureEntryEditor : T extends typeof BundleEditableResourceTypes.diagnosticReport ? DiagnosticReportEntryEditor : BundleEntryEditor;
@@ -0,0 +1,45 @@
1
+ /**
2
+ * File discipline note:
3
+ * - Read `ARCHITECTURE.md` and `CONTRIBUTING.md` before changing this module.
4
+ * - This file owns only exported bundle-editor types and constants.
5
+ * - Do not move helper implementations or class logic here.
6
+ */
7
+ import { ResourceTypesFhirR4 } from '../constants/fhir-resource-types.js';
8
+ import { EmployeeResourceTypes, } from '../utils/employee.js';
9
+ /** Resource types that the shared bundle editors currently know how to open as typed entry editors. */
10
+ export const BundleEditableResourceTypes = Object.freeze({
11
+ employee: EmployeeResourceTypes.employee,
12
+ consent: ResourceTypesFhirR4.Consent,
13
+ observation: ResourceTypesFhirR4.Observation,
14
+ vitalSign: ResourceTypesFhirR4.Observation,
15
+ allergyIntolerance: ResourceTypesFhirR4.AllergyIntolerance,
16
+ condition: ResourceTypesFhirR4.Condition,
17
+ medicationStatement: ResourceTypesFhirR4.MedicationStatement,
18
+ documentReference: ResourceTypesFhirR4.DocumentReference,
19
+ carePlan: ResourceTypesFhirR4.CarePlan,
20
+ flag: ResourceTypesFhirR4.Flag,
21
+ clinicalImpression: ResourceTypesFhirR4.ClinicalImpression,
22
+ device: ResourceTypesFhirR4.Device,
23
+ deviceUseStatement: ResourceTypesFhirR4.DeviceUseStatement,
24
+ encounter: ResourceTypesFhirR4.Encounter,
25
+ coverage: ResourceTypesFhirR4.Coverage,
26
+ immunization: ResourceTypesFhirR4.Immunization,
27
+ procedure: ResourceTypesFhirR4.Procedure,
28
+ diagnosticReport: ResourceTypesFhirR4.DiagnosticReport,
29
+ });
30
+ export const BundleTypes = Object.freeze({
31
+ batch: 'batch',
32
+ document: 'document',
33
+ collection: 'collection',
34
+ transaction: 'transaction',
35
+ });
36
+ /** Canonical validation issues returned by `BundleEditor.validateDocumentAuthoring()`. */
37
+ export const BundleEditorValidationIssues = Object.freeze({
38
+ DocumentModeRequired: 'BundleEditor must be in document mode before document validation.',
39
+ CompositionSubjectRequired: 'Composition.subject is required before document transport.',
40
+ CompositionTypeRequired: 'Composition.type is required before document transport.',
41
+ CompositionTitleRequired: 'Composition.title is required before document transport.',
42
+ CompositionDateRequired: 'Composition.date is required before document transport.',
43
+ CompositionAuthorRequired: 'Composition.author is required before document transport.',
44
+ DocumentEntryRequired: 'Bundle.document requires at least one staged resource entry.',
45
+ });
@@ -176,6 +176,11 @@ export type BundleEntry = {
176
176
  * const responseBundle: BundleJsonApi<BundleEntry | ErrorEntry> = { ... };
177
177
  */
178
178
  export interface BundleJsonApi<T = BundleEntry | ErrorEntry> {
179
+ id?: string;
180
+ meta?: {
181
+ claims?: Record<string, any>;
182
+ [key: string]: any;
183
+ };
179
184
  data: T[];
180
185
  resourceType: 'Bundle';
181
186
  total?: number;
@@ -16,11 +16,13 @@ export type CommunicationAttachedBundleSessionOptions = Readonly<{
16
16
  * Canonical `@context` for outer `Communication` claim payloads.
17
17
  *
18
18
  * Rationale:
19
- * - the outer container is materialized as one FHIR `Communication` resource
20
- * - the inner `resource.meta.claims` rows stay version-agnostic and therefore
21
- * use `FHIR_API`
19
+ * - this value belongs to canonical claims, not to `resource.resourceType`
20
+ * - `resource.resourceType = Communication` may later be projected as FHIR R4
21
+ * - but `resource.meta.claims['@context']` should stay version-agnostic
22
22
  */
23
- export declare const CommunicationAttachmentClaimsContext: "org.hl7.fhir.r4";
23
+ export declare const CommunicationClaimsContext: "org.hl7.fhir.api";
24
+ /** @deprecated Prefer `CommunicationClaimsContext`. */
25
+ export declare const CommunicationAttachmentClaimsContext: "org.hl7.fhir.api";
24
26
  /**
25
27
  * Canonical `@context` for bundle entry `resource.meta.claims`.
26
28
  *
@@ -4,11 +4,13 @@ import { Format } from '../constants/Schemas.js';
4
4
  * Canonical `@context` for outer `Communication` claim payloads.
5
5
  *
6
6
  * Rationale:
7
- * - the outer container is materialized as one FHIR `Communication` resource
8
- * - the inner `resource.meta.claims` rows stay version-agnostic and therefore
9
- * use `FHIR_API`
7
+ * - this value belongs to canonical claims, not to `resource.resourceType`
8
+ * - `resource.resourceType = Communication` may later be projected as FHIR R4
9
+ * - but `resource.meta.claims['@context']` should stay version-agnostic
10
10
  */
11
- export const CommunicationAttachmentClaimsContext = Format.FHIR_R4;
11
+ export const CommunicationClaimsContext = Format.FHIR_API;
12
+ /** @deprecated Prefer `CommunicationClaimsContext`. */
13
+ export const CommunicationAttachmentClaimsContext = CommunicationClaimsContext;
12
14
  /**
13
15
  * Canonical `@context` for bundle entry `resource.meta.claims`.
14
16
  *