gdc-common-utils-ts 2.0.18 → 2.2.2

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 (185) hide show
  1. package/README.md +18 -1
  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/didcomm.d.ts +22 -0
  13. package/dist/constants/didcomm.js +22 -0
  14. package/dist/constants/fhir-resource-types.d.ts +2 -0
  15. package/dist/constants/fhir-resource-types.js +1 -0
  16. package/dist/constants/index.d.ts +1 -0
  17. package/dist/constants/index.js +1 -0
  18. package/dist/constants/lifecycle.d.ts +2 -0
  19. package/dist/constants/lifecycle.js +2 -0
  20. package/dist/constants/verifiable-credentials.d.ts +9 -0
  21. package/dist/constants/verifiable-credentials.js +9 -0
  22. package/dist/examples/bundle-didcomm-payload.d.ts +11 -0
  23. package/dist/examples/bundle-didcomm-payload.js +15 -0
  24. package/dist/examples/communication-attached-bundle-session.js +28 -27
  25. package/dist/examples/communication-didcomm-payload.d.ts +39 -0
  26. package/dist/examples/communication-didcomm-payload.js +44 -0
  27. package/dist/examples/consent-access.js +2 -1
  28. package/dist/examples/employee.d.ts +21 -0
  29. package/dist/examples/employee.js +21 -0
  30. package/dist/examples/index.d.ts +4 -0
  31. package/dist/examples/index.js +4 -0
  32. package/dist/examples/individual-controller.d.ts +27 -0
  33. package/dist/examples/individual-controller.js +28 -1
  34. package/dist/examples/inter-tenant-access-contract.js +3 -2
  35. package/dist/examples/ips-bundle.js +17 -16
  36. package/dist/examples/lifecycle.js +13 -11
  37. package/dist/examples/profile-manager-mem.d.ts +45 -0
  38. package/dist/examples/profile-manager-mem.js +30 -0
  39. package/dist/examples/related-person.d.ts +14 -0
  40. package/dist/examples/related-person.js +18 -4
  41. package/dist/examples/shared.d.ts +13 -3
  42. package/dist/examples/shared.js +14 -4
  43. package/dist/examples/vital-signs.js +1 -1
  44. package/dist/examples/wallet-mem.d.ts +38 -0
  45. package/dist/examples/wallet-mem.js +42 -0
  46. package/dist/index.d.ts +1 -0
  47. package/dist/index.js +1 -0
  48. package/dist/interfaces/IProfileOutboxRepository.d.ts +36 -0
  49. package/dist/interfaces/IProfileOutboxRepository.js +2 -0
  50. package/dist/interfaces/IWallet.d.ts +74 -0
  51. package/dist/interfaces/IWallet.js +2 -0
  52. package/dist/interfaces/IWalletQueue.d.ts +30 -0
  53. package/dist/interfaces/IWalletQueue.js +2 -0
  54. package/dist/interfaces/index.d.ts +8 -0
  55. package/dist/interfaces/index.js +8 -0
  56. package/dist/models/authority-resolution.d.ts +56 -0
  57. package/dist/models/authority-resolution.js +2 -0
  58. package/dist/models/bundle-editor-types.d.ts +89 -0
  59. package/dist/models/bundle-editor-types.js +45 -0
  60. package/dist/models/bundle.d.ts +5 -0
  61. package/dist/models/communication-attached-bundle-session.d.ts +195 -0
  62. package/dist/models/communication-attached-bundle-session.js +36 -0
  63. package/dist/models/confidential-storage.d.ts +2 -1
  64. package/dist/models/consent-rule.d.ts +11 -1
  65. package/dist/models/consent-rule.js +9 -1
  66. package/dist/models/index.d.ts +5 -0
  67. package/dist/models/index.js +5 -0
  68. package/dist/models/individual-onboarding.d.ts +18 -0
  69. package/dist/models/interoperable-claims/allergy-intolerance-claims.d.ts +12 -1
  70. package/dist/models/interoperable-claims/allergy-intolerance-claims.js +12 -1
  71. package/dist/models/interoperable-claims/condition-claims.d.ts +12 -1
  72. package/dist/models/interoperable-claims/condition-claims.js +12 -1
  73. package/dist/models/interoperable-claims/diagnostic-report-claims.d.ts +14 -4
  74. package/dist/models/interoperable-claims/diagnostic-report-claims.js +13 -3
  75. package/dist/models/interoperable-claims/document-reference-claims.d.ts +1 -0
  76. package/dist/models/interoperable-claims/document-reference-claims.js +3 -0
  77. package/dist/models/interoperable-claims/medication-statement-claims.d.ts +17 -0
  78. package/dist/models/interoperable-claims/medication-statement-claims.js +17 -0
  79. package/dist/models/profile-manager.d.ts +85 -0
  80. package/dist/models/profile-manager.js +2 -0
  81. package/dist/models/wallet.d.ts +59 -0
  82. package/dist/models/wallet.js +22 -0
  83. package/dist/utils/allergy-intolerance-entry-editor.d.ts +51 -0
  84. package/dist/utils/allergy-intolerance-entry-editor.js +55 -0
  85. package/dist/utils/authority-resolution.d.ts +37 -0
  86. package/dist/utils/authority-resolution.js +112 -0
  87. package/dist/utils/backend-message-manager-mem.d.ts +78 -0
  88. package/dist/utils/backend-message-manager-mem.js +238 -0
  89. package/dist/utils/bundle-didcomm-payload.d.ts +29 -0
  90. package/dist/utils/bundle-didcomm-payload.js +49 -0
  91. package/dist/utils/bundle-document-builder.d.ts +1 -0
  92. package/dist/utils/bundle-document-builder.js +134 -14
  93. package/dist/utils/bundle-editor-core.d.ts +181 -0
  94. package/dist/utils/bundle-editor-core.js +467 -0
  95. package/dist/utils/bundle-editor-helpers.d.ts +53 -0
  96. package/dist/utils/bundle-editor-helpers.js +146 -0
  97. package/dist/utils/bundle-editor-registry.d.ts +6 -0
  98. package/dist/utils/bundle-editor-registry.js +14 -0
  99. package/dist/utils/bundle-editor.d.ts +21 -722
  100. package/dist/utils/bundle-editor.js +21 -1601
  101. package/dist/utils/bundle-entry-editor.d.ts +96 -0
  102. package/dist/utils/bundle-entry-editor.js +305 -0
  103. package/dist/utils/bundle-query.d.ts +1 -0
  104. package/dist/utils/bundle-query.js +12 -3
  105. package/dist/utils/bundle-reader.d.ts +48 -0
  106. package/dist/utils/bundle-reader.js +175 -1
  107. package/dist/utils/care-plan-entry-editor.d.ts +43 -0
  108. package/dist/utils/care-plan-entry-editor.js +47 -0
  109. package/dist/utils/client-assertion.d.ts +38 -0
  110. package/dist/utils/client-assertion.js +113 -0
  111. package/dist/utils/clinical-impression-entry-editor.d.ts +43 -0
  112. package/dist/utils/clinical-impression-entry-editor.js +47 -0
  113. package/dist/utils/clinical-resource-entry-editor.d.ts +123 -0
  114. package/dist/utils/clinical-resource-entry-editor.js +296 -0
  115. package/dist/utils/communication-attached-bundle-session-helpers.d.ts +54 -0
  116. package/dist/utils/communication-attached-bundle-session-helpers.js +519 -0
  117. package/dist/utils/communication-attached-bundle-session.d.ts +87 -304
  118. package/dist/utils/communication-attached-bundle-session.js +175 -841
  119. package/dist/utils/communication-consent-access-editor.d.ts +85 -0
  120. package/dist/utils/communication-consent-access-editor.js +244 -0
  121. package/dist/utils/communication-didcomm-payload.d.ts +38 -0
  122. package/dist/utils/communication-didcomm-payload.js +85 -0
  123. package/dist/utils/communication-document-reference.d.ts +23 -0
  124. package/dist/utils/communication-document-reference.js +89 -0
  125. package/dist/utils/communication-editor.d.ts +53 -0
  126. package/dist/utils/communication-editor.js +97 -0
  127. package/dist/utils/condition-entry-editor.d.ts +30 -0
  128. package/dist/utils/condition-entry-editor.js +34 -0
  129. package/dist/utils/consent-claim-helpers.d.ts +4 -0
  130. package/dist/utils/consent-claim-helpers.js +15 -1
  131. package/dist/utils/coverage-entry-editor.d.ts +51 -0
  132. package/dist/utils/coverage-entry-editor.js +55 -0
  133. package/dist/utils/device-entry-editor.d.ts +59 -0
  134. package/dist/utils/device-entry-editor.js +63 -0
  135. package/dist/utils/device-use-statement-entry-editor.d.ts +43 -0
  136. package/dist/utils/device-use-statement-entry-editor.js +47 -0
  137. package/dist/utils/diagnostic-report-entry-editor.d.ts +74 -0
  138. package/dist/utils/diagnostic-report-entry-editor.js +136 -0
  139. package/dist/utils/did.d.ts +8 -0
  140. package/dist/utils/did.js +22 -0
  141. package/dist/utils/document-reference-entry-editor.d.ts +62 -0
  142. package/dist/utils/document-reference-entry-editor.js +66 -0
  143. package/dist/utils/employee-entry-editor.d.ts +36 -0
  144. package/dist/utils/employee-entry-editor.js +88 -0
  145. package/dist/utils/employee.d.ts +1 -0
  146. package/dist/utils/employee.js +2 -1
  147. package/dist/utils/encounter-entry-editor.d.ts +51 -0
  148. package/dist/utils/encounter-entry-editor.js +55 -0
  149. package/dist/utils/flag-entry-editor.d.ts +47 -0
  150. package/dist/utils/flag-entry-editor.js +51 -0
  151. package/dist/utils/immunization-entry-editor.d.ts +87 -0
  152. package/dist/utils/immunization-entry-editor.js +169 -0
  153. package/dist/utils/index.d.ts +15 -0
  154. package/dist/utils/index.js +15 -0
  155. package/dist/utils/individual-onboarding-acceptance-credential.d.ts +35 -0
  156. package/dist/utils/individual-onboarding-acceptance-credential.js +55 -0
  157. package/dist/utils/individual-smart.d.ts +59 -0
  158. package/dist/utils/individual-smart.js +135 -0
  159. package/dist/utils/medication-statement-entry-editor.d.ts +90 -0
  160. package/dist/utils/medication-statement-entry-editor.js +94 -0
  161. package/dist/utils/observation-component-entry-editor.d.ts +57 -0
  162. package/dist/utils/observation-component-entry-editor.js +105 -0
  163. package/dist/utils/observation-entry-editor.d.ts +29 -0
  164. package/dist/utils/observation-entry-editor.js +68 -0
  165. package/dist/utils/procedure-entry-editor.d.ts +71 -0
  166. package/dist/utils/procedure-entry-editor.js +75 -0
  167. package/dist/utils/professional-smart.d.ts +87 -0
  168. package/dist/utils/professional-smart.js +118 -4
  169. package/dist/utils/profile-manager-mem.d.ts +69 -0
  170. package/dist/utils/profile-manager-mem.js +79 -0
  171. package/dist/utils/profile-outbox-memory-repository.d.ts +34 -0
  172. package/dist/utils/profile-outbox-memory-repository.js +57 -0
  173. package/dist/utils/same-as.d.ts +40 -0
  174. package/dist/utils/same-as.js +72 -0
  175. package/dist/utils/unified-health-id.d.ts +51 -0
  176. package/dist/utils/unified-health-id.js +92 -0
  177. package/dist/utils/vital-sign-day-batch.d.ts +25 -0
  178. package/dist/utils/vital-sign-day-batch.js +115 -0
  179. package/dist/utils/vital-sign-entry-editor.d.ts +61 -0
  180. package/dist/utils/vital-sign-entry-editor.js +152 -0
  181. package/dist/utils/wallet-mem.d.ts +93 -0
  182. package/dist/utils/wallet-mem.js +277 -0
  183. package/dist/utils/wallet-memory-queue.d.ts +32 -0
  184. package/dist/utils/wallet-memory-queue.js +82 -0
  185. package/package.json +2 -1
@@ -6,9 +6,20 @@ export declare const ConditionClaim: {
6
6
  readonly VerificationStatus: "Condition.verification-status";
7
7
  readonly Category: "Condition.category";
8
8
  readonly Code: "Condition.code";
9
+ /**
10
+ * Canonical CSV/list of related contained resource references or identifiers.
11
+ */
12
+ readonly ContainedReferenceList: "Condition.contained-reference-list";
13
+ /**
14
+ * @deprecated Use `ContainedReferenceList`.
15
+ */
16
+ readonly ContainedResourceList: "Condition.contained-resource-list";
17
+ /**
18
+ * @deprecated Use `ContainedReferenceList`.
19
+ */
9
20
  readonly ContainedDocuments: "Condition.contained-documents";
10
21
  /**
11
- * @deprecated Use `ContainedDocuments`.
22
+ * @deprecated Use `ContainedReferenceList`.
12
23
  */
13
24
  readonly AttachmentContentIds: "Condition.attachment-content-ids";
14
25
  readonly Severity: "Condition.severity";
@@ -8,9 +8,20 @@ export const ConditionClaim = {
8
8
  VerificationStatus: 'Condition.verification-status',
9
9
  Category: 'Condition.category',
10
10
  Code: 'Condition.code',
11
+ /**
12
+ * Canonical CSV/list of related contained resource references or identifiers.
13
+ */
14
+ ContainedReferenceList: 'Condition.contained-reference-list',
15
+ /**
16
+ * @deprecated Use `ContainedReferenceList`.
17
+ */
18
+ ContainedResourceList: 'Condition.contained-resource-list',
19
+ /**
20
+ * @deprecated Use `ContainedReferenceList`.
21
+ */
11
22
  ContainedDocuments: 'Condition.contained-documents',
12
23
  /**
13
- * @deprecated Use `ContainedDocuments`.
24
+ * @deprecated Use `ContainedReferenceList`.
14
25
  */
15
26
  AttachmentContentIds: 'Condition.attachment-content-ids',
16
27
  Severity: 'Condition.severity',
@@ -17,6 +17,17 @@ export declare const DiagnosticReportClaim: {
17
17
  readonly PresentedFormContentType: "DiagnosticReport.presented-form-contenttype";
18
18
  readonly PresentedFormData: "DiagnosticReport.presented-form-data";
19
19
  readonly PresentedFormUrl: "DiagnosticReport.presented-form-url";
20
+ /**
21
+ * Canonical CSV/list of related contained resource references or identifiers.
22
+ */
23
+ readonly ContainedReferenceList: "DiagnosticReport.contained-reference-list";
24
+ /**
25
+ * @deprecated Use `ContainedReferenceList`.
26
+ */
27
+ readonly ContainedResourceList: "DiagnosticReport.contained-resource-list";
28
+ /**
29
+ * @deprecated Use `ContainedReferenceList`.
30
+ */
20
31
  readonly ContainedDocuments: "DiagnosticReport.contained-documents";
21
32
  };
22
33
  /**
@@ -31,7 +42,7 @@ export declare const DiagnosticReportClaim: {
31
42
  * - `get/set/add/removeDiagnosticReportResultList`
32
43
  * - `get/set/add/removeDiagnosticReportPerformerList`
33
44
  * - `get/set/add/removeDiagnosticReportSpecimenList`
34
- * - `get/set/add/removeDiagnosticReportContainedDocuments`
45
+ * - `get/set/add/removeDiagnosticReportContainedResourceReferences`
35
46
  * - `get/setDiagnosticReportPresentedFormContentType`
36
47
  * - `get/setDiagnosticReportPresentedFormData`
37
48
  * - `get/setDiagnosticReportPresentedFormUrl`
@@ -87,10 +98,9 @@ export declare const DiagnosticReportSearchParamToClaimKey: Record<DiagnosticRep
87
98
  *
88
99
  * Do not invent camelCase names. Prefer official FHIR search parameter names
89
100
  * or explicit attachment aliases such as `presented-form-*` and
90
- * `contained-documents`.
101
+ * `contained-reference-list`.
91
102
  *
92
103
  * Keep `DiagnosticReport` paused at the typing/mapping layer until:
93
104
  * 1. `claims-helpers-diagnostic-report.ts` exists
94
- * 2. `CommunicationAttachedBundleSession.upsertActiveDiagnosticReportEntry(...)` exists
95
- * 3. GW Core readers/tests consume the same shared claim keys
105
+ * 2. GW Core readers/tests consume the same shared claim keys
96
106
  */
@@ -18,6 +18,17 @@ export const DiagnosticReportClaim = {
18
18
  PresentedFormContentType: 'DiagnosticReport.presented-form-contenttype',
19
19
  PresentedFormData: 'DiagnosticReport.presented-form-data',
20
20
  PresentedFormUrl: 'DiagnosticReport.presented-form-url',
21
+ /**
22
+ * Canonical CSV/list of related contained resource references or identifiers.
23
+ */
24
+ ContainedReferenceList: 'DiagnosticReport.contained-reference-list',
25
+ /**
26
+ * @deprecated Use `ContainedReferenceList`.
27
+ */
28
+ ContainedResourceList: 'DiagnosticReport.contained-resource-list',
29
+ /**
30
+ * @deprecated Use `ContainedReferenceList`.
31
+ */
21
32
  ContainedDocuments: 'DiagnosticReport.contained-documents',
22
33
  };
23
34
  export const DiagnosticReportClaimSpecs = [
@@ -96,10 +107,9 @@ export const DiagnosticReportSearchParamToClaimKey = {
96
107
  *
97
108
  * Do not invent camelCase names. Prefer official FHIR search parameter names
98
109
  * or explicit attachment aliases such as `presented-form-*` and
99
- * `contained-documents`.
110
+ * `contained-reference-list`.
100
111
  *
101
112
  * Keep `DiagnosticReport` paused at the typing/mapping layer until:
102
113
  * 1. `claims-helpers-diagnostic-report.ts` exists
103
- * 2. `CommunicationAttachedBundleSession.upsertActiveDiagnosticReportEntry(...)` exists
104
- * 3. GW Core readers/tests consume the same shared claim keys
114
+ * 2. GW Core readers/tests consume the same shared claim keys
105
115
  */
@@ -22,6 +22,7 @@ export declare const DocumentReferenceClaim: {
22
22
  readonly Relation: "DocumentReference.relation";
23
23
  readonly Subject: "DocumentReference.subject";
24
24
  readonly Type: "DocumentReference.type";
25
+ readonly UserSelected: "DocumentReference.user-selected";
25
26
  };
26
27
  export type DocumentReferenceClaimKey = typeof DocumentReferenceClaim[keyof typeof DocumentReferenceClaim];
27
28
  /**
@@ -24,6 +24,7 @@ export const DocumentReferenceClaim = {
24
24
  Relation: 'DocumentReference.relation',
25
25
  Subject: 'DocumentReference.subject',
26
26
  Type: 'DocumentReference.type',
27
+ UserSelected: 'DocumentReference.user-selected',
27
28
  };
28
29
  /**
29
30
  * Human-readable reference for UI/docs generators.
@@ -52,6 +53,7 @@ export const DocumentReferenceClaimSpecs = [
52
53
  { key: DocumentReferenceClaim.Relation, meaning: 'Relation type to related document.', example: 'appends' },
53
54
  { key: DocumentReferenceClaim.Subject, meaning: 'URN for the section in the individual index.', example: 'urn:uhix:section:vitals' },
54
55
  { key: DocumentReferenceClaim.Type, meaning: 'Lower-level, sector-specific type.', example: 'http://hl7.org/fhir/ValueSet/c80-doc-typecodes|34133-9' },
56
+ { key: DocumentReferenceClaim.UserSelected, meaning: 'Custom provenance flag telling whether the document was explicitly created or selected by the end user/controller.', example: 'true' },
55
57
  ];
56
58
  /**
57
59
  * Optional mapping helper when converting claims-first payloads to strict FHIR JSON.
@@ -86,4 +88,5 @@ export const DocumentReferenceClaimToFhirPath = {
86
88
  [DocumentReferenceClaim.Relation]: 'DocumentReference.relatesTo.code',
87
89
  [DocumentReferenceClaim.Subject]: 'DocumentReference.subject.reference',
88
90
  [DocumentReferenceClaim.Type]: 'DocumentReference.type.coding',
91
+ [DocumentReferenceClaim.UserSelected]: 'DocumentReference.user-selected',
89
92
  };
@@ -14,6 +14,7 @@ export declare const MedicationStatementClaim: {
14
14
  readonly PartOf: "MedicationStatement.part-of";
15
15
  readonly Source: "MedicationStatement.source";
16
16
  readonly MedicationText: "MedicationStatement.medication-text";
17
+ readonly UserSelected: "MedicationStatement.user-selected";
17
18
  /**
18
19
  * Free-text clinical note.
19
20
  *
@@ -27,6 +28,22 @@ export declare const MedicationStatementClaim: {
27
28
  * `TimingPeriodUnit`, and `DosagePatientInstructionText`.
28
29
  */
29
30
  readonly Note: "MedicationStatement.note";
31
+ /**
32
+ * Canonical CSV/list of related contained resource references or identifiers.
33
+ *
34
+ * Values may be:
35
+ * - `urn:uuid:*`
36
+ * - `ResourceType/urn:uuid:*`
37
+ * - another canonical local resource reference used inside the same bundle
38
+ */
39
+ readonly ContainedReferenceList: "MedicationStatement.contained-reference-list";
40
+ /**
41
+ * @deprecated Use `ContainedReferenceList`.
42
+ */
43
+ readonly ContainedResourceList: "MedicationStatement.contained-resource-list";
44
+ /**
45
+ * @deprecated Use `ContainedReferenceList`.
46
+ */
30
47
  readonly ContainedDocuments: "MedicationStatement.contained-documents";
31
48
  /**
32
49
  * @deprecated Use `ContainedDocuments`.
@@ -16,6 +16,7 @@ export const MedicationStatementClaim = {
16
16
  PartOf: 'MedicationStatement.part-of',
17
17
  Source: 'MedicationStatement.source',
18
18
  MedicationText: 'MedicationStatement.medication-text',
19
+ UserSelected: 'MedicationStatement.user-selected',
19
20
  /**
20
21
  * Free-text clinical note.
21
22
  *
@@ -29,6 +30,22 @@ export const MedicationStatementClaim = {
29
30
  * `TimingPeriodUnit`, and `DosagePatientInstructionText`.
30
31
  */
31
32
  Note: 'MedicationStatement.note',
33
+ /**
34
+ * Canonical CSV/list of related contained resource references or identifiers.
35
+ *
36
+ * Values may be:
37
+ * - `urn:uuid:*`
38
+ * - `ResourceType/urn:uuid:*`
39
+ * - another canonical local resource reference used inside the same bundle
40
+ */
41
+ ContainedReferenceList: 'MedicationStatement.contained-reference-list',
42
+ /**
43
+ * @deprecated Use `ContainedReferenceList`.
44
+ */
45
+ ContainedResourceList: 'MedicationStatement.contained-resource-list',
46
+ /**
47
+ * @deprecated Use `ContainedReferenceList`.
48
+ */
32
49
  ContainedDocuments: 'MedicationStatement.contained-documents',
33
50
  /**
34
51
  * @deprecated Use `ContainedDocuments`.
@@ -0,0 +1,85 @@
1
+ import type { WalletMessagePriority, WalletQueuedMessage } from './wallet';
2
+ /**
3
+ * Minimal local profile descriptor for memory-backed wallet/runtime tests.
4
+ *
5
+ * This stays intentionally below actor-specific SDK facades.
6
+ */
7
+ export type ProfileManagerMemProfile = Readonly<{
8
+ profileId: string;
9
+ displayName?: string;
10
+ did: string;
11
+ }>;
12
+ /**
13
+ * Result returned by one backend message transport after submitting one local
14
+ * queued message envelope.
15
+ */
16
+ export type BackendMessageTransportSubmitResult = Readonly<{
17
+ accepted: boolean;
18
+ retryable?: boolean;
19
+ errorMessage?: string;
20
+ responseEnvelope?: string;
21
+ locationUrl?: string;
22
+ }>;
23
+ /**
24
+ * Result returned by one backend message poll operation after a previous
25
+ * transport submit accepted the request asynchronously.
26
+ */
27
+ export type BackendMessageTransportPollResult = Readonly<{
28
+ pending: boolean;
29
+ completed?: boolean;
30
+ retryable?: boolean;
31
+ errorMessage?: string;
32
+ responseEnvelope?: string;
33
+ }>;
34
+ /**
35
+ * Pluggable submit-only transport used by the low-level backend message manager.
36
+ */
37
+ export type BackendMessageTransport = Readonly<{
38
+ submit(input: Readonly<{
39
+ message: WalletQueuedMessage;
40
+ envelope: string;
41
+ }>): Promise<BackendMessageTransportSubmitResult>;
42
+ poll?(input: Readonly<{
43
+ message: ProfileOutboxMessageRecord;
44
+ }>): Promise<BackendMessageTransportPollResult>;
45
+ }>;
46
+ /**
47
+ * One decoded inbound response associated with one DIDComm thread.
48
+ */
49
+ export type BackendMessageResponseRecord = Readonly<{
50
+ thid: string;
51
+ receivedAt: string;
52
+ content: Record<string, unknown>;
53
+ meta: Record<string, unknown>;
54
+ }>;
55
+ /**
56
+ * Immutable historical record written after one profile message is submitted.
57
+ *
58
+ * It complements the mutable queue state by preserving:
59
+ * - the final submitted envelope
60
+ * - the last known queue status at submission time
61
+ * - the optional decoded response thread reference
62
+ */
63
+ export type ProfileOutboxMessageRecord = Readonly<{
64
+ id: string;
65
+ thid?: string;
66
+ messageType?: string;
67
+ priority: string;
68
+ status: string;
69
+ transportStatus?: 'submitted' | 'completed' | 'failed';
70
+ recordedAt: string;
71
+ payload: Record<string, unknown>;
72
+ envelope: string;
73
+ responseThid?: string;
74
+ locationUrl?: string;
75
+ pollCount?: number;
76
+ }>;
77
+ /**
78
+ * Input used by `BackendMessageManagerMem` and `ProfileManagerMem` to queue one
79
+ * outbound business payload.
80
+ */
81
+ export type QueueProfileMessageInput = Readonly<{
82
+ payload: Record<string, unknown>;
83
+ priority?: WalletMessagePriority;
84
+ recipientEncryptionJwk: Record<string, unknown>;
85
+ }>;
@@ -0,0 +1,2 @@
1
+ // Copyright 2026 Conectate Soluciones y Aplicaciones SL under the Apache License, Version 2.0.
2
+ export {};
@@ -0,0 +1,59 @@
1
+ import type { JWK } from './jwk';
2
+ /**
3
+ * Canonical priority levels for wallet-managed outbound messages.
4
+ *
5
+ * Ordering rule:
6
+ * - `emergency` is always processed before all other priorities
7
+ * - for the same priority level, insertion order must be preserved
8
+ */
9
+ export declare const WalletMessagePriorities: Readonly<{
10
+ readonly Emergency: "emergency";
11
+ readonly High: "high";
12
+ readonly Normal: "normal";
13
+ readonly Low: "low";
14
+ }>;
15
+ export type WalletMessagePriority = typeof WalletMessagePriorities[keyof typeof WalletMessagePriorities];
16
+ /**
17
+ * Lifecycle states for one local wallet queue/outbox message.
18
+ */
19
+ export declare const WalletQueueStatuses: Readonly<{
20
+ readonly Pending: "pending";
21
+ readonly Delivered: "delivered";
22
+ readonly Failed: "failed";
23
+ }>;
24
+ export type WalletQueueStatus = typeof WalletQueueStatuses[keyof typeof WalletQueueStatuses];
25
+ /**
26
+ * One message tracked by the local wallet queue or outbox.
27
+ */
28
+ export type WalletQueuedMessage = Readonly<{
29
+ id: string;
30
+ createdAt: string;
31
+ priority: WalletMessagePriority;
32
+ status: WalletQueueStatus;
33
+ sequence: number;
34
+ payload: Record<string, unknown>;
35
+ thid?: string;
36
+ messageType?: string;
37
+ deliveredAt?: string;
38
+ errorMessage?: string;
39
+ }>;
40
+ /**
41
+ * Input accepted by wallet-local queue implementations when creating one
42
+ * queued outbound message.
43
+ */
44
+ export type WalletEnqueueMessageInput = Readonly<{
45
+ payload: Record<string, unknown>;
46
+ priority?: WalletMessagePriority;
47
+ thid?: string;
48
+ messageType?: string;
49
+ id?: string;
50
+ createdAt?: string;
51
+ }>;
52
+ /**
53
+ * Public summary of one wallet-managed entity key set.
54
+ */
55
+ export type WalletManagedEntityDescriptor = Readonly<{
56
+ entityId: string;
57
+ signingJwk: JWK;
58
+ encryptionJwk: JWK;
59
+ }>;
@@ -0,0 +1,22 @@
1
+ // Copyright 2026 Conectate Soluciones y Aplicaciones SL under the Apache License, Version 2.0.
2
+ /**
3
+ * Canonical priority levels for wallet-managed outbound messages.
4
+ *
5
+ * Ordering rule:
6
+ * - `emergency` is always processed before all other priorities
7
+ * - for the same priority level, insertion order must be preserved
8
+ */
9
+ export const WalletMessagePriorities = Object.freeze({
10
+ Emergency: 'emergency',
11
+ High: 'high',
12
+ Normal: 'normal',
13
+ Low: 'low',
14
+ });
15
+ /**
16
+ * Lifecycle states for one local wallet queue/outbox message.
17
+ */
18
+ export const WalletQueueStatuses = Object.freeze({
19
+ Pending: 'pending',
20
+ Delivered: 'delivered',
21
+ Failed: 'failed',
22
+ });
@@ -0,0 +1,51 @@
1
+ import { ClinicalResourceEntryEditor } from './clinical-resource-entry-editor';
2
+ /**
3
+ * Typed editor for one staged AllergyIntolerance resource entry.
4
+ *
5
+ * Use this from frontend/BFF bundle-authoring flows when the caller needs one
6
+ * allergy row with canonical claims-first accessors.
7
+ */
8
+ export declare class AllergyIntoleranceEntryEditor extends ClinicalResourceEntryEditor {
9
+ /** Writes the canonical allergy identifier. */
10
+ setIdentifier(identifier?: string | null): this;
11
+ /** Reads the canonical allergy identifier. */
12
+ getIdentifier(): string | undefined;
13
+ /** Ensures the allergy entry has one canonical `urn:uuid:*` identifier. */
14
+ ensureIdentifier(): string;
15
+ /** Writes the subject/patient reference for the allergy entry. */
16
+ setSubject(subject?: string | null): this;
17
+ /** Reads the subject/patient reference for the allergy entry. */
18
+ getSubject(): string | undefined;
19
+ /** Writes the coded allergy substance. */
20
+ setCode(code?: string | null): this;
21
+ /** Reads the coded allergy substance. */
22
+ getCode(): string | undefined;
23
+ /** Writes the clinical status. */
24
+ setClinicalStatus(status?: string | null): this;
25
+ /** Reads the clinical status. */
26
+ getClinicalStatus(): string | undefined;
27
+ /** Writes the verification status. */
28
+ setVerificationStatus(status?: string | null): this;
29
+ /** Reads the verification status. */
30
+ getVerificationStatus(): string | undefined;
31
+ /** Writes the allergy category. */
32
+ setCategory(category?: string | null): this;
33
+ /** Reads the allergy category. */
34
+ getCategory(): string | undefined;
35
+ /** Writes the allergy criticality. */
36
+ setCriticality(criticality?: string | null): this;
37
+ /** Reads the allergy criticality. */
38
+ getCriticality(): string | undefined;
39
+ /** Writes the onset date/time. */
40
+ setOnsetDateTime(value?: string | null): this;
41
+ /** Reads the onset date/time. */
42
+ getOnsetDateTime(): string | undefined;
43
+ /** Writes the recorder reference. */
44
+ setRecorder(reference?: string | null): this;
45
+ /** Reads the recorder reference. */
46
+ getRecorder(): string | undefined;
47
+ /** Writes the linked contained-document identifier list. */
48
+ setContainedDocumentIdentifierList(identifiers: readonly string[]): this;
49
+ /** Reads the linked contained-document identifier list. */
50
+ getContainedDocumentIdentifierList(): string[];
51
+ }
@@ -0,0 +1,55 @@
1
+ import { ClinicalResourceEntryEditor } from './clinical-resource-entry-editor.js';
2
+ import { AllergyIntoleranceClaim } from '../models/interoperable-claims/allergy-intolerance-claims.js';
3
+ import { BundleEditableResourceTypes } from '../models/bundle-editor-types.js';
4
+ import { registerBundleEntryEditor } from './bundle-editor-registry.js';
5
+ /**
6
+ * Typed editor for one staged AllergyIntolerance resource entry.
7
+ *
8
+ * Use this from frontend/BFF bundle-authoring flows when the caller needs one
9
+ * allergy row with canonical claims-first accessors.
10
+ */
11
+ export class AllergyIntoleranceEntryEditor extends ClinicalResourceEntryEditor {
12
+ /** Writes the canonical allergy identifier. */
13
+ setIdentifier(identifier) { return this.setIdentifierValue(AllergyIntoleranceClaim.Identifier, identifier); }
14
+ /** Reads the canonical allergy identifier. */
15
+ getIdentifier() { return this.getIdentifierValue(AllergyIntoleranceClaim.Identifier); }
16
+ /** Ensures the allergy entry has one canonical `urn:uuid:*` identifier. */
17
+ ensureIdentifier() { return this.ensureIdentifierValue(AllergyIntoleranceClaim.Identifier); }
18
+ /** Writes the subject/patient reference for the allergy entry. */
19
+ setSubject(subject) { return this.setSubjectClaims(AllergyIntoleranceClaim.Subject, AllergyIntoleranceClaim.Patient, subject); }
20
+ /** Reads the subject/patient reference for the allergy entry. */
21
+ getSubject() { return this.getSubjectClaims(AllergyIntoleranceClaim.Subject, AllergyIntoleranceClaim.Patient); }
22
+ /** Writes the coded allergy substance. */
23
+ setCode(code) { return this.setScalarClaim(AllergyIntoleranceClaim.Code, code); }
24
+ /** Reads the coded allergy substance. */
25
+ getCode() { return this.getScalarClaim(AllergyIntoleranceClaim.Code); }
26
+ /** Writes the clinical status. */
27
+ setClinicalStatus(status) { return this.setScalarClaim(AllergyIntoleranceClaim.ClinicalStatus, status); }
28
+ /** Reads the clinical status. */
29
+ getClinicalStatus() { return this.getScalarClaim(AllergyIntoleranceClaim.ClinicalStatus); }
30
+ /** Writes the verification status. */
31
+ setVerificationStatus(status) { return this.setScalarClaim(AllergyIntoleranceClaim.VerificationStatus, status); }
32
+ /** Reads the verification status. */
33
+ getVerificationStatus() { return this.getScalarClaim(AllergyIntoleranceClaim.VerificationStatus); }
34
+ /** Writes the allergy category. */
35
+ setCategory(category) { return this.setScalarClaim(AllergyIntoleranceClaim.Category, category); }
36
+ /** Reads the allergy category. */
37
+ getCategory() { return this.getScalarClaim(AllergyIntoleranceClaim.Category); }
38
+ /** Writes the allergy criticality. */
39
+ setCriticality(criticality) { return this.setScalarClaim(AllergyIntoleranceClaim.Criticality, criticality); }
40
+ /** Reads the allergy criticality. */
41
+ getCriticality() { return this.getScalarClaim(AllergyIntoleranceClaim.Criticality); }
42
+ /** Writes the onset date/time. */
43
+ setOnsetDateTime(value) { return this.setScalarClaim(AllergyIntoleranceClaim.OnsetDateTime, value); }
44
+ /** Reads the onset date/time. */
45
+ getOnsetDateTime() { return this.getScalarClaim(AllergyIntoleranceClaim.OnsetDateTime); }
46
+ /** Writes the recorder reference. */
47
+ setRecorder(reference) { return this.setScalarClaim(AllergyIntoleranceClaim.Recorder, reference); }
48
+ /** Reads the recorder reference. */
49
+ getRecorder() { return this.getScalarClaim(AllergyIntoleranceClaim.Recorder); }
50
+ /** Writes the linked contained-document identifier list. */
51
+ setContainedDocumentIdentifierList(identifiers) { return this.setCsvClaimList(AllergyIntoleranceClaim.ContainedDocuments, identifiers); }
52
+ /** Reads the linked contained-document identifier list. */
53
+ getContainedDocumentIdentifierList() { return this.getCsvClaimList(AllergyIntoleranceClaim.ContainedDocuments); }
54
+ }
55
+ registerBundleEntryEditor(BundleEditableResourceTypes.allergyIntolerance, AllergyIntoleranceEntryEditor);
@@ -0,0 +1,37 @@
1
+ import type { AuthorityCatalogRecord, AuthorityResolution, AuthorityResolutionInput } from '../models/authority-resolution';
2
+ /**
3
+ * Builds one authority/root `did:web` from a bare host authority or URL.
4
+ *
5
+ * Examples:
6
+ * - `https://gw.example.org` -> `did:web:gw.example.org`
7
+ * - `localhost:3300` -> `did:web:localhost%3A3300`
8
+ */
9
+ export declare function buildAuthorityDidWeb(input: {
10
+ authority: string;
11
+ }): string;
12
+ /**
13
+ * Normalizes one authority base URL from either an explicit URL or one
14
+ * authority/root `did:web`.
15
+ */
16
+ export declare function resolveAuthorityBaseUrl(input: {
17
+ authorityBaseUrl?: string;
18
+ authorityDidWeb?: string;
19
+ }): string | undefined;
20
+ /**
21
+ * Builds one compatibility authority resolution when the caller only knows:
22
+ * - tenant context
23
+ * - one base URL or one root authority `did:web`
24
+ *
25
+ * This helper intentionally keeps the current hosted-DID fallback in one place
26
+ * so app code does not have to hand-invent `did:web` strings.
27
+ */
28
+ export declare function buildLegacyAuthorityResolution(input: AuthorityResolutionInput & Readonly<{
29
+ tenantId: string;
30
+ jurisdiction: string;
31
+ sector: string;
32
+ }>): AuthorityResolution;
33
+ /**
34
+ * Converts one resolution into a catalog-style record so runtimes can preload
35
+ * legacy fallback data into a shared resolver cache.
36
+ */
37
+ export declare function authorityResolutionToCatalogRecord(resolution: AuthorityResolution): AuthorityCatalogRecord;
@@ -0,0 +1,112 @@
1
+ // Copyright 2026 Antifraud Services Inc. under the Apache License, Version 2.0.
2
+ import { buildOrganizationDidWeb, getBaseUrlFromDidWeb } from './did.js';
3
+ function normalizeString(value) {
4
+ return typeof value === 'string' ? value.trim() : '';
5
+ }
6
+ function encodeDidWebAuthority(authority) {
7
+ return authority.replace(/:/g, '%3A').toLowerCase();
8
+ }
9
+ function normalizeAuthorityHost(value) {
10
+ const raw = normalizeString(value).replace(/\/+$/, '');
11
+ if (!raw)
12
+ return '';
13
+ if (/^https?:\/\//i.test(raw)) {
14
+ try {
15
+ return new URL(raw).host;
16
+ }
17
+ catch {
18
+ return raw.replace(/^https?:\/\//i, '');
19
+ }
20
+ }
21
+ return raw;
22
+ }
23
+ function protocolForAuthority(authority) {
24
+ const normalized = authority.trim().toLowerCase();
25
+ return normalized.startsWith('localhost')
26
+ || normalized.startsWith('127.0.0.1')
27
+ || normalized.startsWith('[::1]')
28
+ ? 'http'
29
+ : 'https';
30
+ }
31
+ function inferMatchedBy(input) {
32
+ if (normalizeString(input.subjectDid))
33
+ return 'subject-did';
34
+ if (normalizeString(input.subjectSameAs))
35
+ return 'subject-same-as';
36
+ if (normalizeString(input.authorityDidWeb))
37
+ return 'authority-did';
38
+ if (normalizeString(input.authorityBaseUrl))
39
+ return 'authority-base-url';
40
+ return 'tenant-context';
41
+ }
42
+ /**
43
+ * Builds one authority/root `did:web` from a bare host authority or URL.
44
+ *
45
+ * Examples:
46
+ * - `https://gw.example.org` -> `did:web:gw.example.org`
47
+ * - `localhost:3300` -> `did:web:localhost%3A3300`
48
+ */
49
+ export function buildAuthorityDidWeb(input) {
50
+ const authority = normalizeAuthorityHost(input.authority);
51
+ if (!authority)
52
+ throw new Error('buildAuthorityDidWeb requires authority.');
53
+ return `did:web:${encodeDidWebAuthority(authority)}`;
54
+ }
55
+ /**
56
+ * Normalizes one authority base URL from either an explicit URL or one
57
+ * authority/root `did:web`.
58
+ */
59
+ export function resolveAuthorityBaseUrl(input) {
60
+ const direct = normalizeString(input.authorityBaseUrl);
61
+ if (direct) {
62
+ const host = normalizeAuthorityHost(direct);
63
+ return host ? `${protocolForAuthority(host)}://${host}/` : undefined;
64
+ }
65
+ const did = normalizeString(input.authorityDidWeb);
66
+ if (!did)
67
+ return undefined;
68
+ return getBaseUrlFromDidWeb(did);
69
+ }
70
+ /**
71
+ * Builds one compatibility authority resolution when the caller only knows:
72
+ * - tenant context
73
+ * - one base URL or one root authority `did:web`
74
+ *
75
+ * This helper intentionally keeps the current hosted-DID fallback in one place
76
+ * so app code does not have to hand-invent `did:web` strings.
77
+ */
78
+ export function buildLegacyAuthorityResolution(input) {
79
+ const authorityDidWeb = normalizeString(input.authorityDidWeb)
80
+ || buildAuthorityDidWeb({ authority: normalizeString(input.authorityBaseUrl) });
81
+ const authorityBaseUrl = resolveAuthorityBaseUrl({
82
+ authorityBaseUrl: input.authorityBaseUrl,
83
+ authorityDidWeb,
84
+ });
85
+ const tenantDidWeb = buildOrganizationDidWeb({
86
+ hostDidWeb: authorityDidWeb,
87
+ tenantId: input.tenantId,
88
+ jurisdiction: input.jurisdiction,
89
+ version: normalizeString(input.version) || 'v1',
90
+ sector: input.sector,
91
+ });
92
+ return {
93
+ authorityDidWeb,
94
+ authorityBaseUrl,
95
+ tenantDidWeb,
96
+ metadataUrl: normalizeString(input.metadataUrl) || undefined,
97
+ source: 'legacy',
98
+ matchedBy: inferMatchedBy(input),
99
+ };
100
+ }
101
+ /**
102
+ * Converts one resolution into a catalog-style record so runtimes can preload
103
+ * legacy fallback data into a shared resolver cache.
104
+ */
105
+ export function authorityResolutionToCatalogRecord(resolution) {
106
+ return {
107
+ authorityDidWeb: resolution.authorityDidWeb,
108
+ authorityBaseUrl: resolution.authorityBaseUrl,
109
+ tenantDidWeb: resolution.tenantDidWeb,
110
+ metadataUrl: resolution.metadataUrl,
111
+ };
112
+ }