gdc-common-utils-ts 2.1.0 → 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 (154) hide show
  1. package/README.md +18 -0
  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.js +4 -2
  23. package/dist/examples/communication-attached-bundle-session.js +27 -27
  24. package/dist/examples/communication-didcomm-payload.d.ts +8 -4
  25. package/dist/examples/communication-didcomm-payload.js +17 -11
  26. package/dist/examples/consent-access.js +2 -1
  27. package/dist/examples/employee.d.ts +21 -0
  28. package/dist/examples/employee.js +21 -0
  29. package/dist/examples/individual-controller.d.ts +27 -0
  30. package/dist/examples/individual-controller.js +28 -1
  31. package/dist/examples/inter-tenant-access-contract.js +3 -2
  32. package/dist/examples/ips-bundle.js +17 -16
  33. package/dist/examples/lifecycle.js +13 -11
  34. package/dist/examples/profile-manager-mem.js +2 -1
  35. package/dist/examples/related-person.d.ts +14 -0
  36. package/dist/examples/related-person.js +18 -4
  37. package/dist/examples/shared.d.ts +12 -3
  38. package/dist/examples/shared.js +13 -4
  39. package/dist/examples/vital-signs.js +1 -1
  40. package/dist/examples/wallet-mem.js +4 -2
  41. package/dist/models/authority-resolution.d.ts +56 -0
  42. package/dist/models/authority-resolution.js +2 -0
  43. package/dist/models/bundle-editor-types.d.ts +89 -0
  44. package/dist/models/bundle-editor-types.js +45 -0
  45. package/dist/models/bundle.d.ts +5 -0
  46. package/dist/models/communication-attached-bundle-session.d.ts +6 -4
  47. package/dist/models/communication-attached-bundle-session.js +6 -4
  48. package/dist/models/confidential-storage.d.ts +2 -1
  49. package/dist/models/consent-rule.d.ts +11 -1
  50. package/dist/models/consent-rule.js +9 -1
  51. package/dist/models/index.d.ts +2 -0
  52. package/dist/models/index.js +2 -0
  53. package/dist/models/individual-onboarding.d.ts +18 -0
  54. package/dist/models/interoperable-claims/allergy-intolerance-claims.d.ts +12 -1
  55. package/dist/models/interoperable-claims/allergy-intolerance-claims.js +12 -1
  56. package/dist/models/interoperable-claims/condition-claims.d.ts +12 -1
  57. package/dist/models/interoperable-claims/condition-claims.js +12 -1
  58. package/dist/models/interoperable-claims/diagnostic-report-claims.d.ts +13 -2
  59. package/dist/models/interoperable-claims/diagnostic-report-claims.js +12 -1
  60. package/dist/models/interoperable-claims/document-reference-claims.d.ts +1 -0
  61. package/dist/models/interoperable-claims/document-reference-claims.js +3 -0
  62. package/dist/models/interoperable-claims/medication-statement-claims.d.ts +17 -0
  63. package/dist/models/interoperable-claims/medication-statement-claims.js +17 -0
  64. package/dist/utils/allergy-intolerance-entry-editor.d.ts +51 -0
  65. package/dist/utils/allergy-intolerance-entry-editor.js +55 -0
  66. package/dist/utils/authority-resolution.d.ts +37 -0
  67. package/dist/utils/authority-resolution.js +112 -0
  68. package/dist/utils/backend-message-manager-mem.d.ts +11 -0
  69. package/dist/utils/backend-message-manager-mem.js +11 -0
  70. package/dist/utils/bundle-didcomm-payload.js +3 -2
  71. package/dist/utils/bundle-document-builder.d.ts +1 -0
  72. package/dist/utils/bundle-document-builder.js +134 -14
  73. package/dist/utils/bundle-editor-core.d.ts +181 -0
  74. package/dist/utils/bundle-editor-core.js +467 -0
  75. package/dist/utils/bundle-editor-helpers.d.ts +53 -0
  76. package/dist/utils/bundle-editor-helpers.js +146 -0
  77. package/dist/utils/bundle-editor-registry.d.ts +6 -0
  78. package/dist/utils/bundle-editor-registry.js +14 -0
  79. package/dist/utils/bundle-editor.d.ts +21 -722
  80. package/dist/utils/bundle-editor.js +21 -1601
  81. package/dist/utils/bundle-entry-editor.d.ts +96 -0
  82. package/dist/utils/bundle-entry-editor.js +305 -0
  83. package/dist/utils/bundle-query.d.ts +1 -0
  84. package/dist/utils/bundle-query.js +12 -3
  85. package/dist/utils/bundle-reader.d.ts +48 -0
  86. package/dist/utils/bundle-reader.js +175 -1
  87. package/dist/utils/care-plan-entry-editor.d.ts +43 -0
  88. package/dist/utils/care-plan-entry-editor.js +47 -0
  89. package/dist/utils/client-assertion.d.ts +38 -0
  90. package/dist/utils/client-assertion.js +113 -0
  91. package/dist/utils/clinical-impression-entry-editor.d.ts +43 -0
  92. package/dist/utils/clinical-impression-entry-editor.js +47 -0
  93. package/dist/utils/clinical-resource-entry-editor.d.ts +123 -0
  94. package/dist/utils/clinical-resource-entry-editor.js +296 -0
  95. package/dist/utils/communication-attached-bundle-session-helpers.js +8 -6
  96. package/dist/utils/communication-attached-bundle-session.d.ts +29 -3
  97. package/dist/utils/communication-attached-bundle-session.js +62 -3
  98. package/dist/utils/communication-didcomm-payload.d.ts +5 -0
  99. package/dist/utils/communication-didcomm-payload.js +28 -18
  100. package/dist/utils/communication-document-reference.d.ts +23 -0
  101. package/dist/utils/communication-document-reference.js +89 -0
  102. package/dist/utils/communication-editor.d.ts +53 -0
  103. package/dist/utils/communication-editor.js +97 -0
  104. package/dist/utils/condition-entry-editor.d.ts +30 -0
  105. package/dist/utils/condition-entry-editor.js +34 -0
  106. package/dist/utils/consent-claim-helpers.d.ts +4 -0
  107. package/dist/utils/consent-claim-helpers.js +15 -1
  108. package/dist/utils/coverage-entry-editor.d.ts +51 -0
  109. package/dist/utils/coverage-entry-editor.js +55 -0
  110. package/dist/utils/device-entry-editor.d.ts +59 -0
  111. package/dist/utils/device-entry-editor.js +63 -0
  112. package/dist/utils/device-use-statement-entry-editor.d.ts +43 -0
  113. package/dist/utils/device-use-statement-entry-editor.js +47 -0
  114. package/dist/utils/diagnostic-report-entry-editor.d.ts +74 -0
  115. package/dist/utils/diagnostic-report-entry-editor.js +136 -0
  116. package/dist/utils/did.d.ts +8 -0
  117. package/dist/utils/did.js +22 -0
  118. package/dist/utils/document-reference-entry-editor.d.ts +62 -0
  119. package/dist/utils/document-reference-entry-editor.js +66 -0
  120. package/dist/utils/employee-entry-editor.d.ts +36 -0
  121. package/dist/utils/employee-entry-editor.js +88 -0
  122. package/dist/utils/employee.d.ts +1 -0
  123. package/dist/utils/employee.js +2 -1
  124. package/dist/utils/encounter-entry-editor.d.ts +51 -0
  125. package/dist/utils/encounter-entry-editor.js +55 -0
  126. package/dist/utils/flag-entry-editor.d.ts +47 -0
  127. package/dist/utils/flag-entry-editor.js +51 -0
  128. package/dist/utils/immunization-entry-editor.d.ts +87 -0
  129. package/dist/utils/immunization-entry-editor.js +169 -0
  130. package/dist/utils/index.d.ts +7 -0
  131. package/dist/utils/index.js +7 -0
  132. package/dist/utils/individual-onboarding-acceptance-credential.d.ts +35 -0
  133. package/dist/utils/individual-onboarding-acceptance-credential.js +55 -0
  134. package/dist/utils/individual-smart.d.ts +59 -0
  135. package/dist/utils/individual-smart.js +135 -0
  136. package/dist/utils/medication-statement-entry-editor.d.ts +90 -0
  137. package/dist/utils/medication-statement-entry-editor.js +94 -0
  138. package/dist/utils/observation-component-entry-editor.d.ts +57 -0
  139. package/dist/utils/observation-component-entry-editor.js +105 -0
  140. package/dist/utils/observation-entry-editor.d.ts +29 -0
  141. package/dist/utils/observation-entry-editor.js +68 -0
  142. package/dist/utils/procedure-entry-editor.d.ts +71 -0
  143. package/dist/utils/procedure-entry-editor.js +75 -0
  144. package/dist/utils/professional-smart.d.ts +87 -0
  145. package/dist/utils/professional-smart.js +118 -4
  146. package/dist/utils/same-as.d.ts +40 -0
  147. package/dist/utils/same-as.js +72 -0
  148. package/dist/utils/unified-health-id.d.ts +51 -0
  149. package/dist/utils/unified-health-id.js +92 -0
  150. package/dist/utils/vital-sign-day-batch.d.ts +25 -0
  151. package/dist/utils/vital-sign-day-batch.js +115 -0
  152. package/dist/utils/vital-sign-entry-editor.d.ts +61 -0
  153. package/dist/utils/vital-sign-entry-editor.js +152 -0
  154. package/package.json +2 -1
@@ -1,4 +1,5 @@
1
1
  export * from './actor.js';
2
+ export * from './authority-resolution.js';
2
3
  export * from './activation-policy.js';
3
4
  export * from './base-convert.js';
4
5
  export * from './baseN.js';
@@ -34,6 +35,7 @@ export * from './gw-core-path.js';
34
35
  export * from './gw-core-commercial-contract.js';
35
36
  export * from './legal-organization-verification-result.js';
36
37
  export * from './communication-fhir-r4.js';
38
+ export * from './communication-editor.js';
37
39
  export * from './communication-document-reference.js';
38
40
  export * from './communication-bundle-document-request.js';
39
41
  export * from './communication-identity.js';
@@ -48,6 +50,7 @@ export * from './communication-didcomm-payload.js';
48
50
  export * from './confidential-storage-persistence.js';
49
51
  export * from './confidential-storage-test-data.js';
50
52
  export * from './permission-templates.js';
53
+ export * from './client-assertion.js';
51
54
  export * from './professional-smart.js';
52
55
  export * from './related-person-list.js';
53
56
  export * from './clinical-resource-converters.js';
@@ -56,6 +59,7 @@ export * from './clinical-resource-view.js';
56
59
  export * from './fhir-validator.js';
57
60
  export * from './family-registration-test-data.js';
58
61
  export * from './individual-form-pdf.js';
62
+ export * from './individual-smart.js';
59
63
  export * from './individual-organization-claims.js';
60
64
  export * from './inter-tenant-access-contract.js';
61
65
  export * from './legal-organization-onboarding-editor.js';
@@ -64,6 +68,7 @@ export * from './organization-did-binding.js';
64
68
  export * from './organization-authorization-urn.js';
65
69
  export * from './individual-organization-lifecycle.js';
66
70
  export * from './individual-onboarding-editor.js';
71
+ export * from './individual-onboarding-acceptance-credential.js';
67
72
  export * from './individual-onboarding-document-reference.js';
68
73
  export * from './individual-organization-kyc.js';
69
74
  export * from './individual-bundle-vault.js';
@@ -88,12 +93,14 @@ export * from './normalize.js';
88
93
  export * from './object-convert.js';
89
94
  export * from './normalize-uuid.js';
90
95
  export * from './object-sanitize.js';
96
+ export * from './unified-health-id.js';
91
97
  export * from './permission-templates.js';
92
98
  export * from './smart-scope.js';
93
99
  export * from './service-act-reasons.js';
94
100
  export * from './same-as.js';
95
101
  export * from './activation-request.js';
96
102
  export * from './vp-token.js';
103
+ export * from './vital-sign-day-batch.js';
97
104
  export * from './wallet-mem.js';
98
105
  export * from './wallet-memory-queue.js';
99
106
  export * from './profile-outbox-memory-repository.js';
@@ -0,0 +1,35 @@
1
+ import type { VerifiableCredentialV2 } from '../models/verifiable-credential';
2
+ /**
3
+ * Input for the canonical individual-onboarding acceptance credential.
4
+ *
5
+ * This helper builds the evidence object that a frontend/BFF can later sign
6
+ * with the user profile key pair before sending it as an attachment.
7
+ *
8
+ * Canonical semantics:
9
+ * - `credentialSubject.memberOf.taxID` is the organization tax identifier
10
+ * - `credentialSubject.hasOccupation.identifier.value` defaults to `RESPRSN`
11
+ * - `credentialSubject.hasCredential.material` binds the credential to the
12
+ * profile signing material
13
+ */
14
+ export type IndividualOnboardingAcceptanceCredentialInput = Readonly<{
15
+ issuerDid: string;
16
+ subjectDid: string;
17
+ organizationTaxId: string;
18
+ profileKeyMaterial: string;
19
+ validFrom: string;
20
+ credentialId?: string;
21
+ representativeIdentifier?: string;
22
+ representativeRoleCode?: string;
23
+ sameAs?: string;
24
+ validUntil?: string;
25
+ proof?: VerifiableCredentialV2['proof'];
26
+ }>;
27
+ /**
28
+ * Builds the canonical Verifiable Credential for individual onboarding
29
+ * acceptance.
30
+ *
31
+ * The result is unsigned by design. Callers sign it with the user profile key
32
+ * pair and then attach the signed VC to the `Organization/_transaction`
33
+ * request.
34
+ */
35
+ export declare function buildIndividualOnboardingAcceptanceCredential(input: IndividualOnboardingAcceptanceCredentialInput): VerifiableCredentialV2;
@@ -0,0 +1,55 @@
1
+ import { ActivationCredentialTypes, W3cCredentialContexts, W3cCredentialTypes } from '../constants/verifiable-credentials.js';
2
+ import { ClaimsPersonSchemaorg } from '../constants/schemaorg.js';
3
+ function normalizeText(value) {
4
+ return typeof value === 'string' ? value.trim() : '';
5
+ }
6
+ function requireText(value, fieldName) {
7
+ const normalized = normalizeText(value);
8
+ if (!normalized) {
9
+ throw new Error(`buildIndividualOnboardingAcceptanceCredential requires ${fieldName}.`);
10
+ }
11
+ return normalized;
12
+ }
13
+ /**
14
+ * Builds the canonical Verifiable Credential for individual onboarding
15
+ * acceptance.
16
+ *
17
+ * The result is unsigned by design. Callers sign it with the user profile key
18
+ * pair and then attach the signed VC to the `Organization/_transaction`
19
+ * request.
20
+ */
21
+ export function buildIndividualOnboardingAcceptanceCredential(input) {
22
+ const issuerDid = requireText(input.issuerDid, 'issuerDid');
23
+ const subjectDid = requireText(input.subjectDid, 'subjectDid');
24
+ const organizationTaxId = requireText(input.organizationTaxId, 'organizationTaxId');
25
+ const profileKeyMaterial = requireText(input.profileKeyMaterial, 'profileKeyMaterial');
26
+ const validFrom = requireText(input.validFrom, 'validFrom');
27
+ const roleCode = normalizeText(input.representativeRoleCode) || 'RESPRSN';
28
+ return {
29
+ '@context': [W3cCredentialContexts.V2, 'https://schema.org'],
30
+ ...(normalizeText(input.credentialId) ? { id: normalizeText(input.credentialId) } : {}),
31
+ type: [W3cCredentialTypes.VerifiableCredential, ActivationCredentialTypes.LegalRepresentativeCredential],
32
+ issuer: issuerDid,
33
+ credentialSubject: {
34
+ id: subjectDid,
35
+ memberOf: {
36
+ taxID: organizationTaxId,
37
+ },
38
+ hasOccupation: {
39
+ identifier: {
40
+ value: roleCode,
41
+ },
42
+ },
43
+ hasCredential: {
44
+ material: profileKeyMaterial,
45
+ },
46
+ ...(normalizeText(input.representativeIdentifier)
47
+ ? { [ClaimsPersonSchemaorg.identifierValue]: normalizeText(input.representativeIdentifier) }
48
+ : {}),
49
+ ...(normalizeText(input.sameAs) ? { sameAs: normalizeText(input.sameAs) } : {}),
50
+ },
51
+ validFrom,
52
+ ...(normalizeText(input.validUntil) ? { validUntil: normalizeText(input.validUntil) } : {}),
53
+ ...(input.proof ? { proof: input.proof } : {}),
54
+ };
55
+ }
@@ -0,0 +1,59 @@
1
+ export type IndividualActorIdentityCredentialInput = Readonly<{
2
+ actorDid: string;
3
+ subjectDid?: string;
4
+ relationship?: string;
5
+ authorityBasis?: string;
6
+ email?: string;
7
+ sameAs?: string | readonly string[];
8
+ telephone?: string;
9
+ credentialMaterial?: string;
10
+ evidence?: readonly Record<string, unknown>[];
11
+ additionalCredentialSubject?: Record<string, unknown>;
12
+ additionalCredential?: Record<string, unknown>;
13
+ }>;
14
+ export type IndividualActorIdentityVpPayloadInput = Readonly<{
15
+ clientId: string;
16
+ actorDid: string;
17
+ subjectDid?: string;
18
+ relationship?: string;
19
+ authorityBasis?: string;
20
+ email?: string;
21
+ sameAs?: string | readonly string[];
22
+ telephone?: string;
23
+ credentialMaterial?: string;
24
+ evidence?: readonly Record<string, unknown>[];
25
+ verifiableCredential?: string | Record<string, unknown> | ReadonlyArray<string | Record<string, unknown>>;
26
+ additionalVp?: Record<string, unknown>;
27
+ additionalPayload?: Record<string, unknown>;
28
+ }>;
29
+ export type IndividualSubjectCredentialInput = Readonly<{
30
+ subjectDid: string;
31
+ sameAs?: string | readonly string[];
32
+ telephone?: string;
33
+ evidence?: readonly Record<string, unknown>[];
34
+ additionalCredentialSubject?: Record<string, unknown>;
35
+ additionalCredential?: Record<string, unknown>;
36
+ }>;
37
+ export type IndividualControllerCredentialInput = IndividualActorIdentityCredentialInput;
38
+ export type IndividualControllerVpPayloadInput = IndividualActorIdentityVpPayloadInput;
39
+ export type IndividualMemberCredentialInput = IndividualActorIdentityCredentialInput;
40
+ export type IndividualMemberVpPayloadInput = IndividualActorIdentityVpPayloadInput;
41
+ export declare function getIndividualControllerIdentitySameAs(input: Readonly<Pick<IndividualControllerCredentialInput, 'sameAs' | 'email'>>): string[];
42
+ export declare function getIndividualControllerIdentityTelephone(input: Readonly<Pick<IndividualControllerCredentialInput, 'telephone'>>): string | undefined;
43
+ export declare function getIndividualControllerIdentityVC(input: IndividualControllerCredentialInput): Record<string, unknown>;
44
+ export declare function buildIndividualControllerIdentityVpPayload(input: IndividualControllerVpPayloadInput): Record<string, unknown>;
45
+ export declare function buildUnsignedIndividualControllerIdentityVpJwt(input: IndividualControllerVpPayloadInput, options?: Readonly<{
46
+ nowSeconds?: number;
47
+ ttlSeconds?: number;
48
+ nonce?: string;
49
+ }>): string;
50
+ export declare function getIndividualSubjectVC(input: IndividualSubjectCredentialInput): Record<string, unknown>;
51
+ export declare function getIndividualMemberIdentitySameAs(input: Readonly<Pick<IndividualMemberCredentialInput, 'sameAs' | 'email'>>): string[];
52
+ export declare function getIndividualMemberIdentityTelephone(input: Readonly<Pick<IndividualMemberCredentialInput, 'telephone'>>): string | undefined;
53
+ export declare function getIndividualMemberIdentityVC(input: IndividualMemberCredentialInput): Record<string, unknown>;
54
+ export declare function buildIndividualMemberIdentityVpPayload(input: IndividualMemberVpPayloadInput): Record<string, unknown>;
55
+ export declare function buildUnsignedIndividualMemberIdentityVpJwt(input: IndividualMemberVpPayloadInput, options?: Readonly<{
56
+ nowSeconds?: number;
57
+ ttlSeconds?: number;
58
+ nonce?: string;
59
+ }>): string;
@@ -0,0 +1,135 @@
1
+ import { ClaimsPersonSchemaorg } from '../constants/schemaorg.js';
2
+ import { IndividualCredentialTypes, W3cCredentialTypes, } from '../constants/verifiable-credentials.js';
3
+ import { normalizeSameAsHashCsv, normalizeSameAsHashList, normalizeTelephoneHash } from './same-as.js';
4
+ import { buildUnsignedVpJwt } from './jwt.js';
5
+ function getIndividualIdentitySameAs(input) {
6
+ const sameAsCandidates = [];
7
+ if (input.sameAs) {
8
+ sameAsCandidates.push(...normalizeSameAsHashList(input.sameAs));
9
+ }
10
+ if (input.email) {
11
+ sameAsCandidates.push(...normalizeSameAsHashList(input.email));
12
+ }
13
+ return [...new Set(sameAsCandidates)];
14
+ }
15
+ function getIndividualIdentityTelephone(input) {
16
+ const normalized = normalizeTelephoneHash(String(input.telephone || ''));
17
+ return normalized || undefined;
18
+ }
19
+ function buildIndividualIdentityVC(input, credentialType) {
20
+ const normalizedSameAs = getIndividualIdentitySameAs(input);
21
+ const normalizedTelephone = getIndividualIdentityTelephone(input);
22
+ const normalizedCredentialMaterial = String(input.credentialMaterial || '').trim();
23
+ const normalizedSubjectDid = String(input.subjectDid || '').trim();
24
+ const normalizedRelationship = String(input.relationship || '').trim();
25
+ const normalizedAuthorityBasis = String(input.authorityBasis || '').trim();
26
+ return {
27
+ type: [
28
+ W3cCredentialTypes.VerifiableCredential,
29
+ credentialType,
30
+ ],
31
+ credentialSubject: {
32
+ id: String(input.actorDid || '').trim(),
33
+ ...(normalizedSubjectDid ? { subject: normalizedSubjectDid } : {}),
34
+ ...(normalizedRelationship ? { relationship: normalizedRelationship } : {}),
35
+ ...(normalizedAuthorityBasis ? { authorityBasis: normalizedAuthorityBasis } : {}),
36
+ ...(normalizedSameAs.length
37
+ ? { sameAs: normalizeSameAsHashCsv(normalizedSameAs) }
38
+ : {}),
39
+ ...(normalizedTelephone
40
+ ? { [ClaimsPersonSchemaorg.telephone]: normalizedTelephone }
41
+ : {}),
42
+ ...(normalizedCredentialMaterial
43
+ ? { [ClaimsPersonSchemaorg.hasCredentialMaterial]: normalizedCredentialMaterial }
44
+ : {}),
45
+ ...(input.additionalCredentialSubject || {}),
46
+ },
47
+ ...(Array.isArray(input.evidence) && input.evidence.length
48
+ ? { evidence: [...input.evidence] }
49
+ : {}),
50
+ ...(input.additionalCredential || {}),
51
+ };
52
+ }
53
+ function buildIndividualIdentityVpPayload(input, credentialType) {
54
+ const credentials = Array.isArray(input.verifiableCredential)
55
+ ? [...input.verifiableCredential]
56
+ : input.verifiableCredential
57
+ ? [input.verifiableCredential]
58
+ : [buildIndividualIdentityVC({
59
+ actorDid: input.actorDid,
60
+ subjectDid: input.subjectDid,
61
+ relationship: input.relationship,
62
+ authorityBasis: input.authorityBasis,
63
+ email: input.email,
64
+ sameAs: input.sameAs,
65
+ telephone: input.telephone,
66
+ credentialMaterial: input.credentialMaterial,
67
+ evidence: input.evidence,
68
+ }, credentialType)];
69
+ return {
70
+ ...(input.additionalPayload || {}),
71
+ vp: {
72
+ holder: String(input.clientId || '').trim(),
73
+ verifiableCredential: credentials,
74
+ ...(input.additionalVp || {}),
75
+ },
76
+ };
77
+ }
78
+ export function getIndividualControllerIdentitySameAs(input) {
79
+ return getIndividualIdentitySameAs(input);
80
+ }
81
+ export function getIndividualControllerIdentityTelephone(input) {
82
+ return getIndividualIdentityTelephone(input);
83
+ }
84
+ export function getIndividualControllerIdentityVC(input) {
85
+ return buildIndividualIdentityVC(input, IndividualCredentialTypes.IndividualControllerCredential);
86
+ }
87
+ export function buildIndividualControllerIdentityVpPayload(input) {
88
+ return buildIndividualIdentityVpPayload(input, IndividualCredentialTypes.IndividualControllerCredential);
89
+ }
90
+ export function buildUnsignedIndividualControllerIdentityVpJwt(input, options = {}) {
91
+ return buildUnsignedVpJwt(buildIndividualControllerIdentityVpPayload(input), options);
92
+ }
93
+ export function getIndividualSubjectVC(input) {
94
+ const normalizedSameAs = getIndividualIdentitySameAs({
95
+ sameAs: input.sameAs,
96
+ });
97
+ const normalizedTelephone = getIndividualIdentityTelephone({
98
+ telephone: input.telephone,
99
+ });
100
+ return {
101
+ type: [
102
+ W3cCredentialTypes.VerifiableCredential,
103
+ IndividualCredentialTypes.IndividualSubjectCredential,
104
+ ],
105
+ credentialSubject: {
106
+ id: String(input.subjectDid || '').trim(),
107
+ ...(normalizedSameAs.length
108
+ ? { sameAs: normalizeSameAsHashCsv(normalizedSameAs) }
109
+ : {}),
110
+ ...(normalizedTelephone
111
+ ? { [ClaimsPersonSchemaorg.telephone]: normalizedTelephone }
112
+ : {}),
113
+ ...(input.additionalCredentialSubject || {}),
114
+ },
115
+ ...(Array.isArray(input.evidence) && input.evidence.length
116
+ ? { evidence: [...input.evidence] }
117
+ : {}),
118
+ ...(input.additionalCredential || {}),
119
+ };
120
+ }
121
+ export function getIndividualMemberIdentitySameAs(input) {
122
+ return getIndividualIdentitySameAs(input);
123
+ }
124
+ export function getIndividualMemberIdentityTelephone(input) {
125
+ return getIndividualIdentityTelephone(input);
126
+ }
127
+ export function getIndividualMemberIdentityVC(input) {
128
+ return buildIndividualIdentityVC(input, IndividualCredentialTypes.IndividualMemberCredential);
129
+ }
130
+ export function buildIndividualMemberIdentityVpPayload(input) {
131
+ return buildIndividualIdentityVpPayload(input, IndividualCredentialTypes.IndividualMemberCredential);
132
+ }
133
+ export function buildUnsignedIndividualMemberIdentityVpJwt(input, options = {}) {
134
+ return buildUnsignedVpJwt(buildIndividualMemberIdentityVpPayload(input), options);
135
+ }
@@ -0,0 +1,90 @@
1
+ /**
2
+ * File discipline note:
3
+ * - Read `ARCHITECTURE.md` and `CONTRIBUTING.md` before changing this module.
4
+ * - Keep exactly one exported class per file.
5
+ * - Keep this file focused on one typed editor surface.
6
+ * - Move shared helpers to reusable helper/base modules instead of duplicating logic here.
7
+ */
8
+ import { ClinicalResourceEntryEditor } from './clinical-resource-entry-editor';
9
+ /**
10
+ * Typed editor for one staged MedicationStatement resource entry.
11
+ *
12
+ * Use this surface in the frontend when the user creates, corrects, or reviews
13
+ * medication data one entry at a time before the final document is built.
14
+ */
15
+ export declare class MedicationStatementEntryEditor extends ClinicalResourceEntryEditor {
16
+ /** Overrides the canonical identifier when import or migration logic needs one explicit public id. */
17
+ setIdentifier(identifier?: string | null): this;
18
+ /** Returns the canonical identifier currently exposed for this medication entry. */
19
+ getIdentifier(): string | undefined;
20
+ /** Ensures the entry has one synchronized canonical identifier across public claim, `resource.id`, and `fullUrl`. */
21
+ ensureIdentifier(): string;
22
+ /** Sets the subject/patient reference for this medication statement. */
23
+ setSubject(subject?: string | null): this;
24
+ /** Returns the subject/patient reference for this medication statement. */
25
+ getSubject(): string | undefined;
26
+ /** Sets the medication statement status. */
27
+ setStatus(status?: string | null): this;
28
+ /** Returns the medication statement status. */
29
+ getStatus(): string | undefined;
30
+ /** Sets the effective date or period token stored in the flat-claims model. */
31
+ setEffective(value?: string | null): this;
32
+ /** Returns the effective date or period token. */
33
+ getEffective(): string | undefined;
34
+ /** Sets the coded medication identifier/value used by downstream FHIR export. */
35
+ setCode(code?: string | null): this;
36
+ /** Returns the coded medication identifier/value. */
37
+ getCode(): string | undefined;
38
+ /** Sets the human-readable medication text shown in UI cards and document narratives. */
39
+ setMedicationText(text?: string | null): this;
40
+ /** Returns the human-readable medication text. */
41
+ getMedicationText(): string | undefined;
42
+ /** Sets one free-text note attached to the medication entry. */
43
+ setNote(note?: string | null): this;
44
+ /** Returns the current medication note. */
45
+ getNote(): string | undefined;
46
+ /** Sets one flat-text dosage instruction. */
47
+ setDosageInstruction(value?: string | null): this;
48
+ /** Returns the flat-text dosage instruction. */
49
+ getDosageInstruction(): string | undefined;
50
+ /** Replaces the medication category/section tags used by document assembly and local filtering. */
51
+ setCategoryList(values: readonly string[]): this;
52
+ /** Returns the medication category/section tags. */
53
+ getCategoryList(): string[];
54
+ /** Sets the numeric dose quantity value. */
55
+ setDoseQuantityValue(value?: number | null): this;
56
+ /** Returns the numeric dose quantity value. */
57
+ getDoseQuantityValue(): number | undefined;
58
+ /** Sets the dose quantity unit token. */
59
+ setDoseQuantityUnit(value?: string | null): this;
60
+ /** Returns the dose quantity unit token. */
61
+ getDoseQuantityUnit(): string | undefined;
62
+ /** Sets the timing frequency for structured dosage authoring. */
63
+ setTimingFrequency(value?: number | null): this;
64
+ /** Returns the timing frequency. */
65
+ getTimingFrequency(): number | undefined;
66
+ /** Sets the timing period for structured dosage authoring. */
67
+ setTimingPeriod(value?: number | null): this;
68
+ /** Returns the timing period. */
69
+ getTimingPeriod(): number | undefined;
70
+ /** Sets the timing period unit token. */
71
+ setTimingPeriodUnit(value?: string | null): this;
72
+ /** Returns the timing period unit token. */
73
+ getTimingPeriodUnit(): string | undefined;
74
+ /** Marks whether this dosage is `as needed`. */
75
+ setDosageAsNeeded(value?: boolean | null): this;
76
+ /** Returns whether this dosage is `as needed`. */
77
+ getDosageAsNeeded(): boolean | undefined;
78
+ /** Replaces the linked child-resource reference list, typically `DocumentReference/...` items. */
79
+ setContainedResourceReferenceList(references: readonly string[]): this;
80
+ /** Returns the linked child-resource reference list. */
81
+ getContainedResourceReferenceList(): string[];
82
+ /** Marks whether the medication was user-entered or user-confirmed in self-managed flows. */
83
+ setUserSelected(value?: boolean | null): this;
84
+ /** Returns whether the medication was marked as user-selected. */
85
+ getUserSelected(): boolean | undefined;
86
+ /** @deprecated Use `setContainedResourceReferenceList(...)`. */
87
+ setContainedDocumentIdentifierList(identifiers: readonly string[]): this;
88
+ /** @deprecated Use `getContainedResourceReferenceList()`. */
89
+ getContainedDocumentIdentifierList(): string[];
90
+ }
@@ -0,0 +1,94 @@
1
+ /**
2
+ * File discipline note:
3
+ * - Read `ARCHITECTURE.md` and `CONTRIBUTING.md` before changing this module.
4
+ * - Keep exactly one exported class per file.
5
+ * - Keep this file focused on one typed editor surface.
6
+ * - Move shared helpers to reusable helper/base modules instead of duplicating logic here.
7
+ */
8
+ import { ClinicalResourceEntryEditor } from './clinical-resource-entry-editor.js';
9
+ import { MedicationStatementClaim, MedicationStatementClaimsFhirApiExtended } from '../models/interoperable-claims/medication-statement-claims.js';
10
+ import { BundleEditableResourceTypes } from '../models/bundle-editor-types.js';
11
+ import { registerBundleEntryEditor } from './bundle-editor-registry.js';
12
+ /**
13
+ * Typed editor for one staged MedicationStatement resource entry.
14
+ *
15
+ * Use this surface in the frontend when the user creates, corrects, or reviews
16
+ * medication data one entry at a time before the final document is built.
17
+ */
18
+ export class MedicationStatementEntryEditor extends ClinicalResourceEntryEditor {
19
+ /** Overrides the canonical identifier when import or migration logic needs one explicit public id. */
20
+ setIdentifier(identifier) { return this.setIdentifierValue(MedicationStatementClaim.Identifier, identifier); }
21
+ /** Returns the canonical identifier currently exposed for this medication entry. */
22
+ getIdentifier() { return this.getIdentifierValue(MedicationStatementClaim.Identifier); }
23
+ /** Ensures the entry has one synchronized canonical identifier across public claim, `resource.id`, and `fullUrl`. */
24
+ ensureIdentifier() { return this.ensureIdentifierValue(MedicationStatementClaim.Identifier); }
25
+ /** Sets the subject/patient reference for this medication statement. */
26
+ setSubject(subject) { return this.setSubjectClaims(MedicationStatementClaim.Subject, MedicationStatementClaim.Patient, subject); }
27
+ /** Returns the subject/patient reference for this medication statement. */
28
+ getSubject() { return this.getSubjectClaims(MedicationStatementClaim.Subject, MedicationStatementClaim.Patient); }
29
+ /** Sets the medication statement status. */
30
+ setStatus(status) { return this.setScalarClaim(MedicationStatementClaim.Status, status); }
31
+ /** Returns the medication statement status. */
32
+ getStatus() { return this.getScalarClaim(MedicationStatementClaim.Status); }
33
+ /** Sets the effective date or period token stored in the flat-claims model. */
34
+ setEffective(value) { return this.setScalarClaim(MedicationStatementClaim.Effective, value); }
35
+ /** Returns the effective date or period token. */
36
+ getEffective() { return this.getScalarClaim(MedicationStatementClaim.Effective); }
37
+ /** Sets the coded medication identifier/value used by downstream FHIR export. */
38
+ setCode(code) { return this.setScalarClaim(MedicationStatementClaim.Code, code); }
39
+ /** Returns the coded medication identifier/value. */
40
+ getCode() { return this.getScalarClaim(MedicationStatementClaim.Code); }
41
+ /** Sets the human-readable medication text shown in UI cards and document narratives. */
42
+ setMedicationText(text) { return this.setScalarClaim(MedicationStatementClaim.MedicationText, text); }
43
+ /** Returns the human-readable medication text. */
44
+ getMedicationText() { return this.getScalarClaim(MedicationStatementClaim.MedicationText); }
45
+ /** Sets one free-text note attached to the medication entry. */
46
+ setNote(note) { return this.setScalarClaim(MedicationStatementClaim.Note, note); }
47
+ /** Returns the current medication note. */
48
+ getNote() { return this.getScalarClaim(MedicationStatementClaim.Note); }
49
+ /** Sets one flat-text dosage instruction. */
50
+ setDosageInstruction(value) { return this.setScalarClaim(MedicationStatementClaim.DosageInstruction, value); }
51
+ /** Returns the flat-text dosage instruction. */
52
+ getDosageInstruction() { return this.getScalarClaim(MedicationStatementClaim.DosageInstruction); }
53
+ /** Replaces the medication category/section tags used by document assembly and local filtering. */
54
+ setCategoryList(values) { return this.setCsvClaimList(MedicationStatementClaim.Category, values); }
55
+ /** Returns the medication category/section tags. */
56
+ getCategoryList() { return this.getCsvClaimList(MedicationStatementClaim.Category); }
57
+ /** Sets the numeric dose quantity value. */
58
+ setDoseQuantityValue(value) { return this.setNumberClaim(MedicationStatementClaimsFhirApiExtended.DoseQuantityValue, value); }
59
+ /** Returns the numeric dose quantity value. */
60
+ getDoseQuantityValue() { return this.getNumberClaim(MedicationStatementClaimsFhirApiExtended.DoseQuantityValue); }
61
+ /** Sets the dose quantity unit token. */
62
+ setDoseQuantityUnit(value) { return this.setScalarClaim(MedicationStatementClaimsFhirApiExtended.DoseQuantityUnit, value); }
63
+ /** Returns the dose quantity unit token. */
64
+ getDoseQuantityUnit() { return this.getScalarClaim(MedicationStatementClaimsFhirApiExtended.DoseQuantityUnit); }
65
+ /** Sets the timing frequency for structured dosage authoring. */
66
+ setTimingFrequency(value) { return this.setNumberClaim(MedicationStatementClaimsFhirApiExtended.TimingFrequency, value); }
67
+ /** Returns the timing frequency. */
68
+ getTimingFrequency() { return this.getNumberClaim(MedicationStatementClaimsFhirApiExtended.TimingFrequency); }
69
+ /** Sets the timing period for structured dosage authoring. */
70
+ setTimingPeriod(value) { return this.setNumberClaim(MedicationStatementClaimsFhirApiExtended.TimingPeriod, value); }
71
+ /** Returns the timing period. */
72
+ getTimingPeriod() { return this.getNumberClaim(MedicationStatementClaimsFhirApiExtended.TimingPeriod); }
73
+ /** Sets the timing period unit token. */
74
+ setTimingPeriodUnit(value) { return this.setScalarClaim(MedicationStatementClaimsFhirApiExtended.TimingPeriodUnit, value); }
75
+ /** Returns the timing period unit token. */
76
+ getTimingPeriodUnit() { return this.getScalarClaim(MedicationStatementClaimsFhirApiExtended.TimingPeriodUnit); }
77
+ /** Marks whether this dosage is `as needed`. */
78
+ setDosageAsNeeded(value) { return this.setBooleanClaim(MedicationStatementClaimsFhirApiExtended.DosageAsNeeded, value); }
79
+ /** Returns whether this dosage is `as needed`. */
80
+ getDosageAsNeeded() { return this.getBooleanClaim(MedicationStatementClaimsFhirApiExtended.DosageAsNeeded); }
81
+ /** Replaces the linked child-resource reference list, typically `DocumentReference/...` items. */
82
+ setContainedResourceReferenceList(references) { return this.setCsvClaimList(MedicationStatementClaim.ContainedReferenceList, references); }
83
+ /** Returns the linked child-resource reference list. */
84
+ getContainedResourceReferenceList() { return this.getCsvClaimList(MedicationStatementClaim.ContainedReferenceList); }
85
+ /** Marks whether the medication was user-entered or user-confirmed in self-managed flows. */
86
+ setUserSelected(value) { return this.setBooleanClaim(MedicationStatementClaim.UserSelected, value); }
87
+ /** Returns whether the medication was marked as user-selected. */
88
+ getUserSelected() { return this.getBooleanClaim(MedicationStatementClaim.UserSelected); }
89
+ /** @deprecated Use `setContainedResourceReferenceList(...)`. */
90
+ setContainedDocumentIdentifierList(identifiers) { return this.setContainedResourceReferenceList(identifiers); }
91
+ /** @deprecated Use `getContainedResourceReferenceList()`. */
92
+ getContainedDocumentIdentifierList() { return this.getContainedResourceReferenceList(); }
93
+ }
94
+ registerBundleEntryEditor(BundleEditableResourceTypes.medicationStatement, MedicationStatementEntryEditor);
@@ -0,0 +1,57 @@
1
+ /**
2
+ * File discipline note:
3
+ * - Read `ARCHITECTURE.md` and `CONTRIBUTING.md` before changing this module.
4
+ * - Keep exactly one exported class per file.
5
+ * - Keep this file focused on one typed editor surface.
6
+ * - Move shared helpers to reusable helper/base modules instead of duplicating logic here.
7
+ */
8
+ import { type CodingDescriptor } from '../constants/vital-signs';
9
+ import { BundleEntryEditor } from './bundle-entry-editor';
10
+ /**
11
+ * Typed editor for one staged ObservationComponent resource entry.
12
+ *
13
+ * Keep this surface thin and claim-focused so 101 tests can teach one
14
+ * resource at a time without exposing bundle-internal plumbing.
15
+ */
16
+ export declare class ObservationComponentEntryEditor extends BundleEntryEditor {
17
+ setCode(code: CodingDescriptor | string): this;
18
+ getCode(): string | undefined;
19
+ setCodeSystem(system: string): this;
20
+ getCodeSystem(): string | undefined;
21
+ setCodeValue(value: string): this;
22
+ getCodeValue(): string | undefined;
23
+ setCodeDisplay(display: string): this;
24
+ getCodeDisplay(): string | undefined;
25
+ /**
26
+ * Stores the local-language label used by forms and local UI copy.
27
+ *
28
+ * Keep this distinct from `setCodeDisplay(...)`, which is the canonical
29
+ * English/international display carried by the coded concept.
30
+ */
31
+ setCodeTextLocal(text: string): this;
32
+ /**
33
+ * Returns the local-language label used by forms and local UI copy.
34
+ *
35
+ * Keep this distinct from `getCodeDisplay()`, which returns the canonical
36
+ * English/international display when present.
37
+ */
38
+ getCodeTextLocal(): string | undefined;
39
+ /** Compatibility alias for older examples/tests. Prefer `setCodeTextLocal(...)`. */
40
+ setLocalText(text: string): this;
41
+ /** Compatibility alias for older examples/tests. Prefer `getCodeTextLocal()`. */
42
+ getLocalText(): string | undefined;
43
+ setValueQuantityNumber(value: number): this;
44
+ getValueQuantityNumber(): number | undefined;
45
+ setValueQuantityUnit(unit: CodingDescriptor | string): this;
46
+ getValueQuantityUnit(): string | undefined;
47
+ setValueString(value: string): this;
48
+ getValueString(): string | undefined;
49
+ setValueDate(value: string): this;
50
+ getValueDate(): string | undefined;
51
+ }
52
+ /**
53
+ * Vital-sign-specific editor surface for one staged Observation entry.
54
+ *
55
+ * This layer applies the visible/searchable Vital Signs claim contract on top
56
+ * of the reduced Observation component helpers.
57
+ */