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
@@ -0,0 +1,105 @@
1
+ import { ObservationClaim } from '../models/interoperable-claims/observation-claims.js';
2
+ import { normalizeOptionalIdentifier } from './bundle-editor-helpers.js';
3
+ import { BundleEntryEditor } from './bundle-entry-editor.js';
4
+ /**
5
+ * Typed editor for one staged ObservationComponent resource entry.
6
+ *
7
+ * Keep this surface thin and claim-focused so 101 tests can teach one
8
+ * resource at a time without exposing bundle-internal plumbing.
9
+ */
10
+ export class ObservationComponentEntryEditor extends BundleEntryEditor {
11
+ setCode(code) {
12
+ const token = typeof code === 'string' ? code.trim() : code.claim;
13
+ this.setClaim(ObservationClaim.Code, token);
14
+ if (typeof code !== 'string') {
15
+ this.setClaim(ObservationClaim.CodeSystem, code.system);
16
+ this.setClaim(ObservationClaim.CodeValue, code.code);
17
+ if (code.display) {
18
+ this.setClaim(ObservationClaim.CodeDisplay, code.display);
19
+ }
20
+ }
21
+ return this;
22
+ }
23
+ getCode() {
24
+ return normalizeOptionalIdentifier(this.getClaim(ObservationClaim.Code));
25
+ }
26
+ setCodeSystem(system) {
27
+ return this.setClaim(ObservationClaim.CodeSystem, String(system).trim());
28
+ }
29
+ getCodeSystem() {
30
+ return normalizeOptionalIdentifier(this.getClaim(ObservationClaim.CodeSystem));
31
+ }
32
+ setCodeValue(value) {
33
+ return this.setClaim(ObservationClaim.CodeValue, String(value).trim());
34
+ }
35
+ getCodeValue() {
36
+ return normalizeOptionalIdentifier(this.getClaim(ObservationClaim.CodeValue));
37
+ }
38
+ setCodeDisplay(display) {
39
+ return this.setClaim(ObservationClaim.CodeDisplay, String(display).trim());
40
+ }
41
+ getCodeDisplay() {
42
+ return normalizeOptionalIdentifier(this.getClaim(ObservationClaim.CodeDisplay));
43
+ }
44
+ /**
45
+ * Stores the local-language label used by forms and local UI copy.
46
+ *
47
+ * Keep this distinct from `setCodeDisplay(...)`, which is the canonical
48
+ * English/international display carried by the coded concept.
49
+ */
50
+ setCodeTextLocal(text) {
51
+ return this.setClaim(ObservationClaim.CodeText, String(text).trim());
52
+ }
53
+ /**
54
+ * Returns the local-language label used by forms and local UI copy.
55
+ *
56
+ * Keep this distinct from `getCodeDisplay()`, which returns the canonical
57
+ * English/international display when present.
58
+ */
59
+ getCodeTextLocal() {
60
+ return normalizeOptionalIdentifier(this.getClaim(ObservationClaim.CodeText));
61
+ }
62
+ /** Compatibility alias for older examples/tests. Prefer `setCodeTextLocal(...)`. */
63
+ setLocalText(text) {
64
+ return this.setCodeTextLocal(text);
65
+ }
66
+ /** Compatibility alias for older examples/tests. Prefer `getCodeTextLocal()`. */
67
+ getLocalText() {
68
+ return this.getCodeTextLocal();
69
+ }
70
+ setValueQuantityNumber(value) {
71
+ return this.setClaim(ObservationClaim.ValueQuantityNumber, String(value));
72
+ }
73
+ getValueQuantityNumber() {
74
+ const raw = this.getClaim(ObservationClaim.ValueQuantityNumber);
75
+ if (raw === undefined || raw === null || raw === '')
76
+ return undefined;
77
+ const numeric = Number(raw);
78
+ return Number.isFinite(numeric) ? numeric : undefined;
79
+ }
80
+ setValueQuantityUnit(unit) {
81
+ const normalized = typeof unit === 'string' ? unit.trim() : unit.claim;
82
+ return this.setClaim(ObservationClaim.ValueQuantityUnit, normalized);
83
+ }
84
+ getValueQuantityUnit() {
85
+ return normalizeOptionalIdentifier(this.getClaim(ObservationClaim.ValueQuantityUnit));
86
+ }
87
+ setValueString(value) {
88
+ return this.setClaim(ObservationClaim.ValueString, String(value).trim());
89
+ }
90
+ getValueString() {
91
+ return normalizeOptionalIdentifier(this.getClaim(ObservationClaim.ValueString));
92
+ }
93
+ setValueDate(value) {
94
+ return this.setClaim(ObservationClaim.ValueDate, String(value).trim());
95
+ }
96
+ getValueDate() {
97
+ return normalizeOptionalIdentifier(this.getClaim(ObservationClaim.ValueDate));
98
+ }
99
+ }
100
+ /**
101
+ * Vital-sign-specific editor surface for one staged Observation entry.
102
+ *
103
+ * This layer applies the visible/searchable Vital Signs claim contract on top
104
+ * of the reduced Observation component helpers.
105
+ */
@@ -0,0 +1,29 @@
1
+ import { VitalSignEntryEditor } from './vital-sign-entry-editor';
2
+ /**
3
+ * Typed editor for one staged Observation resource entry.
4
+ *
5
+ * Use this when a caller needs to stage one observation row with claims-first
6
+ * accessors in a bundle authoring flow.
7
+ */
8
+ export declare class ObservationEntryEditor extends VitalSignEntryEditor {
9
+ /** Writes the based-on reference. */
10
+ setBasedOn(reference: string): this;
11
+ /** Reads the based-on reference. */
12
+ getBasedOn(): string | undefined;
13
+ /** Writes the encounter reference. */
14
+ setEncounter(reference: string): this;
15
+ /** Reads the encounter reference. */
16
+ getEncounter(): string | undefined;
17
+ /** Writes the performer reference. */
18
+ setPerformer(reference: string): this;
19
+ /** Reads the performer reference. */
20
+ getPerformer(): string | undefined;
21
+ /** Writes the has-member reference. */
22
+ setHasMember(reference: string): this;
23
+ /** Reads the has-member reference. */
24
+ getHasMember(): string | undefined;
25
+ /** Writes the has-member list. */
26
+ setHasMemberList(references: readonly string[]): this;
27
+ /** Reads the has-member list. */
28
+ getHasMemberList(): string[];
29
+ }
@@ -0,0 +1,68 @@
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 { ObservationClaim } from '../models/interoperable-claims/observation-claims.js';
9
+ import { BundleEditableResourceTypes } from '../models/bundle-editor-types.js';
10
+ import { normalizeOptionalIdentifier } from './bundle-editor-helpers.js';
11
+ import { VitalSignEntryEditor } from './vital-sign-entry-editor.js';
12
+ import { getClaimValues, setClaimValues } from '../claims/claim-list-helpers.js';
13
+ import { registerBundleEntryEditor } from './bundle-editor-registry.js';
14
+ /**
15
+ * Typed editor for one staged Observation resource entry.
16
+ *
17
+ * Use this when a caller needs to stage one observation row with claims-first
18
+ * accessors in a bundle authoring flow.
19
+ */
20
+ export class ObservationEntryEditor extends VitalSignEntryEditor {
21
+ /** Writes the based-on reference. */
22
+ setBasedOn(reference) {
23
+ return this.setClaim(ObservationClaim.BasedOn, String(reference).trim());
24
+ }
25
+ /** Reads the based-on reference. */
26
+ getBasedOn() {
27
+ return normalizeOptionalIdentifier(this.getClaim(ObservationClaim.BasedOn));
28
+ }
29
+ /** Writes the encounter reference. */
30
+ setEncounter(reference) {
31
+ return this.setClaim(ObservationClaim.Encounter, String(reference).trim());
32
+ }
33
+ /** Reads the encounter reference. */
34
+ getEncounter() {
35
+ return normalizeOptionalIdentifier(this.getClaim(ObservationClaim.Encounter));
36
+ }
37
+ /** Writes the performer reference. */
38
+ setPerformer(reference) {
39
+ return this.setClaim(ObservationClaim.Performer, String(reference).trim());
40
+ }
41
+ /** Reads the performer reference. */
42
+ getPerformer() {
43
+ return normalizeOptionalIdentifier(this.getClaim(ObservationClaim.Performer));
44
+ }
45
+ /** Writes the has-member reference. */
46
+ setHasMember(reference) {
47
+ return this.setClaim(ObservationClaim.HasMember, String(reference).trim());
48
+ }
49
+ /** Reads the has-member reference. */
50
+ getHasMember() {
51
+ return normalizeOptionalIdentifier(this.getClaim(ObservationClaim.HasMember));
52
+ }
53
+ /** Writes the has-member list. */
54
+ setHasMemberList(references) {
55
+ const next = setClaimValues({}, ObservationClaim.HasMember, references);
56
+ const normalized = normalizeOptionalIdentifier(next[ObservationClaim.HasMember]);
57
+ if (!normalized) {
58
+ this.removeClaim(ObservationClaim.HasMember);
59
+ return this;
60
+ }
61
+ return this.setClaim(ObservationClaim.HasMember, normalized);
62
+ }
63
+ /** Reads the has-member list. */
64
+ getHasMemberList() {
65
+ return getClaimValues(this.getClaims(), ObservationClaim.HasMember);
66
+ }
67
+ }
68
+ registerBundleEntryEditor(BundleEditableResourceTypes.observation, ObservationEntryEditor);
@@ -0,0 +1,71 @@
1
+ import { ClinicalResourceEntryEditor } from './clinical-resource-entry-editor';
2
+ /**
3
+ * Typed editor for one staged Procedure resource entry.
4
+ *
5
+ * Use this when a caller needs to stage one procedure row with claims-first
6
+ * accessors in a bundle authoring flow.
7
+ */
8
+ export declare class ProcedureEntryEditor extends ClinicalResourceEntryEditor {
9
+ /** Writes the canonical procedure identifier. */
10
+ setIdentifier(identifier?: string | null): this;
11
+ /** Reads the canonical procedure identifier. */
12
+ getIdentifier(): string | undefined;
13
+ /** Ensures the procedure entry has one canonical `urn:uuid:*` identifier. */
14
+ ensureIdentifier(): string;
15
+ /** Writes the subject/patient reference. */
16
+ setSubject(subject?: string | null): this;
17
+ /** Reads the subject/patient reference. */
18
+ getSubject(): string | undefined;
19
+ /** Writes the procedure status. */
20
+ setStatus(status?: string | null): this;
21
+ /** Reads the procedure status. */
22
+ getStatus(): string | undefined;
23
+ /** Writes the procedure date. */
24
+ setDate(date?: string | null): this;
25
+ /** Reads the procedure date. */
26
+ getDate(): string | undefined;
27
+ /** Writes the procedure code. */
28
+ setCode(code?: string | null): this;
29
+ /** Reads the procedure code. */
30
+ getCode(): string | undefined;
31
+ /** Writes the local code text. */
32
+ setCodeTextLocal(text?: string | null): this;
33
+ /** Reads the local code text. */
34
+ getCodeTextLocal(): string | undefined;
35
+ /** Writes the code display text. */
36
+ setCodeDisplay(display?: string | null): this;
37
+ /** Reads the code display text. */
38
+ getCodeDisplay(): string | undefined;
39
+ /** Writes the encounter reference. */
40
+ setEncounter(reference?: string | null): this;
41
+ /** Reads the encounter reference. */
42
+ getEncounter(): string | undefined;
43
+ /** Writes the location reference. */
44
+ setLocation(reference?: string | null): this;
45
+ /** Reads the location reference. */
46
+ getLocation(): string | undefined;
47
+ /** Writes the reason code. */
48
+ setReasonCode(code?: string | null): this;
49
+ /** Reads the reason code. */
50
+ getReasonCode(): string | undefined;
51
+ /** Writes the note text. */
52
+ setNote(note?: string | null): this;
53
+ /** Reads the note text. */
54
+ getNote(): string | undefined;
55
+ /** Alias for `setNote(...)` used by callers that expect clinical wording. */
56
+ setClinicalNote(note?: string | null): this;
57
+ /** Alias for `getNote()` used by callers that expect clinical wording. */
58
+ getClinicalNote(): string | undefined;
59
+ /** Writes the performer list. */
60
+ setPerformerList(references: readonly string[]): this;
61
+ /** Reads the performer list. */
62
+ getPerformerList(): string[];
63
+ /** Writes the based-on list. */
64
+ setBasedOnList(references: readonly string[]): this;
65
+ /** Reads the based-on list. */
66
+ getBasedOnList(): string[];
67
+ /** Writes the reason-reference list. */
68
+ setReasonReferenceList(references: readonly string[]): this;
69
+ /** Reads the reason-reference list. */
70
+ getReasonReferenceList(): string[];
71
+ }
@@ -0,0 +1,75 @@
1
+ import { ClinicalResourceEntryEditor } from './clinical-resource-entry-editor.js';
2
+ import { ProcedureClaim } from '../models/interoperable-claims/procedure-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 Procedure resource entry.
7
+ *
8
+ * Use this when a caller needs to stage one procedure row with claims-first
9
+ * accessors in a bundle authoring flow.
10
+ */
11
+ export class ProcedureEntryEditor extends ClinicalResourceEntryEditor {
12
+ /** Writes the canonical procedure identifier. */
13
+ setIdentifier(identifier) { return this.setIdentifierValue(ProcedureClaim.Identifier, identifier); }
14
+ /** Reads the canonical procedure identifier. */
15
+ getIdentifier() { return this.getIdentifierValue(ProcedureClaim.Identifier); }
16
+ /** Ensures the procedure entry has one canonical `urn:uuid:*` identifier. */
17
+ ensureIdentifier() { return this.ensureIdentifierValue(ProcedureClaim.Identifier); }
18
+ /** Writes the subject/patient reference. */
19
+ setSubject(subject) { return this.setSubjectClaims(ProcedureClaim.Subject, ProcedureClaim.Patient, subject); }
20
+ /** Reads the subject/patient reference. */
21
+ getSubject() { return this.getSubjectClaims(ProcedureClaim.Subject, ProcedureClaim.Patient); }
22
+ /** Writes the procedure status. */
23
+ setStatus(status) { return this.setScalarClaim(ProcedureClaim.Status, status); }
24
+ /** Reads the procedure status. */
25
+ getStatus() { return this.getScalarClaim(ProcedureClaim.Status); }
26
+ /** Writes the procedure date. */
27
+ setDate(date) { return this.setScalarClaim(ProcedureClaim.Date, date); }
28
+ /** Reads the procedure date. */
29
+ getDate() { return this.getScalarClaim(ProcedureClaim.Date); }
30
+ /** Writes the procedure code. */
31
+ setCode(code) { return this.setScalarClaim(ProcedureClaim.Code, code); }
32
+ /** Reads the procedure code. */
33
+ getCode() { return this.getScalarClaim(ProcedureClaim.Code); }
34
+ /** Writes the local code text. */
35
+ setCodeTextLocal(text) { return this.setScalarClaim(ProcedureClaim.CodeText, text); }
36
+ /** Reads the local code text. */
37
+ getCodeTextLocal() { return this.getScalarClaim(ProcedureClaim.CodeText); }
38
+ /** Writes the code display text. */
39
+ setCodeDisplay(display) { return this.setScalarClaim(ProcedureClaim.CodeDisplay, display); }
40
+ /** Reads the code display text. */
41
+ getCodeDisplay() { return this.getScalarClaim(ProcedureClaim.CodeDisplay); }
42
+ /** Writes the encounter reference. */
43
+ setEncounter(reference) { return this.setScalarClaim(ProcedureClaim.Encounter, reference); }
44
+ /** Reads the encounter reference. */
45
+ getEncounter() { return this.getScalarClaim(ProcedureClaim.Encounter); }
46
+ /** Writes the location reference. */
47
+ setLocation(reference) { return this.setScalarClaim(ProcedureClaim.Location, reference); }
48
+ /** Reads the location reference. */
49
+ getLocation() { return this.getScalarClaim(ProcedureClaim.Location); }
50
+ /** Writes the reason code. */
51
+ setReasonCode(code) { return this.setScalarClaim(ProcedureClaim.ReasonCode, code); }
52
+ /** Reads the reason code. */
53
+ getReasonCode() { return this.getScalarClaim(ProcedureClaim.ReasonCode); }
54
+ /** Writes the note text. */
55
+ setNote(note) { return this.setScalarClaim(ProcedureClaim.Note, note); }
56
+ /** Reads the note text. */
57
+ getNote() { return this.getScalarClaim(ProcedureClaim.Note); }
58
+ /** Alias for `setNote(...)` used by callers that expect clinical wording. */
59
+ setClinicalNote(note) { return this.setNote(note); }
60
+ /** Alias for `getNote()` used by callers that expect clinical wording. */
61
+ getClinicalNote() { return this.getNote(); }
62
+ /** Writes the performer list. */
63
+ setPerformerList(references) { return this.setCsvClaimList(ProcedureClaim.Performer, references); }
64
+ /** Reads the performer list. */
65
+ getPerformerList() { return this.getCsvClaimList(ProcedureClaim.Performer); }
66
+ /** Writes the based-on list. */
67
+ setBasedOnList(references) { return this.setCsvClaimList(ProcedureClaim.BasedOn, references); }
68
+ /** Reads the based-on list. */
69
+ getBasedOnList() { return this.getCsvClaimList(ProcedureClaim.BasedOn); }
70
+ /** Writes the reason-reference list. */
71
+ setReasonReferenceList(references) { return this.setCsvClaimList(ProcedureClaim.ReasonReference, references); }
72
+ /** Reads the reason-reference list. */
73
+ getReasonReferenceList() { return this.getCsvClaimList(ProcedureClaim.ReasonReference); }
74
+ }
75
+ registerBundleEntryEditor(BundleEditableResourceTypes.procedure, ProcedureEntryEditor);
@@ -1,6 +1,10 @@
1
1
  export type ProfessionalEmployeeCredentialInput = Readonly<{
2
2
  actorDid: string;
3
3
  role: string;
4
+ email?: string;
5
+ sameAs?: string | readonly string[];
6
+ telephone?: string;
7
+ credentialMaterial?: string;
4
8
  additionalCredentialSubject?: Record<string, unknown>;
5
9
  additionalCredential?: Record<string, unknown>;
6
10
  }>;
@@ -8,14 +12,97 @@ export type ProfessionalSmartVpPayloadInput = Readonly<{
8
12
  clientId: string;
9
13
  actorDid: string;
10
14
  role: string;
15
+ email?: string;
16
+ sameAs?: string | readonly string[];
17
+ telephone?: string;
18
+ credentialMaterial?: string;
11
19
  verifiableCredential?: string | Record<string, unknown> | ReadonlyArray<string | Record<string, unknown>>;
12
20
  additionalVp?: Record<string, unknown>;
13
21
  additionalPayload?: Record<string, unknown>;
14
22
  }>;
23
+ /**
24
+ * Returns the normalized public continuity aliases for one professional
25
+ * identity VC.
26
+ *
27
+ * The canonical source is:
28
+ * - explicit `sameAs` values when present
29
+ * - otherwise the public employee email
30
+ *
31
+ * When both are present they are merged and deduplicated after normalization.
32
+ *
33
+ * @param input Professional identity source values.
34
+ */
35
+ export declare function getProfessionalIdentitySameAs(input: Readonly<Pick<ProfessionalEmployeeCredentialInput, 'sameAs' | 'email'>>): string[];
36
+ /**
37
+ * Returns the normalized public telephone continuity value for one
38
+ * professional identity VC.
39
+ *
40
+ * Telephone continuity is kept separate from `sameAs` so callers can reuse
41
+ * ICA-compatible hashing without overloading the public alias slot.
42
+ *
43
+ * @param input Professional identity source values.
44
+ */
45
+ export declare function getProfessionalIdentityTelephone(input: Readonly<Pick<ProfessionalEmployeeCredentialInput, 'telephone'>>): string | undefined;
46
+ /**
47
+ * Builds the canonical professional identity VC payload reused by SMART VP
48
+ * token helpers and higher SDK facades.
49
+ *
50
+ * Current projection rules:
51
+ * - `credentialSubject.sameAs` stores one CSV string to preserve compatibility
52
+ * with the current flat/shared claim style
53
+ * - `credentialSubject.telephone` stores the hashed public phone continuity
54
+ * value when present
55
+ * - `credentialSubject.hasCredential.material` carries the public signing/bind
56
+ * material when present
57
+ *
58
+ * @param input Professional identity source values.
59
+ */
60
+ export declare function getProfessionalIdentityVC(input: ProfessionalEmployeeCredentialInput): Record<string, unknown>;
61
+ /**
62
+ * Backwards-compatible alias kept for existing SMART demo callers.
63
+ *
64
+ * @param input Professional identity source values.
65
+ */
15
66
  export declare function buildProfessionalEmployeeCredential(input: ProfessionalEmployeeCredentialInput): Record<string, unknown>;
67
+ /**
68
+ * Builds one SMART/OpenID4VP payload for the current professional identity
69
+ * contract.
70
+ *
71
+ * When no credential is supplied explicitly, the payload embeds the canonical
72
+ * professional identity VC built from the current actor identity input.
73
+ *
74
+ * @param input SMART/OpenID4VP actor payload input.
75
+ */
16
76
  export declare function buildProfessionalSmartVpPayload(input: ProfessionalSmartVpPayloadInput): Record<string, unknown>;
77
+ /**
78
+ * Alias that makes the VC/VP naming more explicit for consumers that want one
79
+ * identity-oriented surface rather than the historical SMART-specific helper
80
+ * names.
81
+ *
82
+ * @param input SMART/OpenID4VP actor payload input.
83
+ */
84
+ export declare function buildProfessionalIdentityVpPayload(input: ProfessionalSmartVpPayloadInput): Record<string, unknown>;
85
+ /**
86
+ * Builds one unsigned compact VP JWT for the canonical professional identity
87
+ * payload.
88
+ *
89
+ * @param input SMART/OpenID4VP actor payload input.
90
+ * @param options Optional unsigned JWT timing controls.
91
+ */
17
92
  export declare function buildUnsignedProfessionalSmartVpJwt(input: ProfessionalSmartVpPayloadInput, options?: Readonly<{
18
93
  nowSeconds?: number;
19
94
  ttlSeconds?: number;
20
95
  nonce?: string;
21
96
  }>): string;
97
+ /**
98
+ * Alias that makes the unsigned identity VP helper explicit for shared SDK
99
+ * facades.
100
+ *
101
+ * @param input SMART/OpenID4VP actor payload input.
102
+ * @param options Optional unsigned JWT timing controls.
103
+ */
104
+ export declare function buildUnsignedProfessionalIdentityVpJwt(input: ProfessionalSmartVpPayloadInput, options?: Readonly<{
105
+ nowSeconds?: number;
106
+ ttlSeconds?: number;
107
+ nonce?: string;
108
+ }>): string;
@@ -1,27 +1,114 @@
1
+ import { ClaimsPersonSchemaorg } from '../constants/schemaorg.js';
1
2
  import { ProfessionalCredentialTypes, W3cCredentialTypes, } from '../constants/verifiable-credentials.js';
3
+ import { normalizeSameAsHashCsv, normalizeSameAsHashList, normalizeTelephoneHash } from './same-as.js';
2
4
  import { buildUnsignedVpJwt } from './jwt.js';
3
- export function buildProfessionalEmployeeCredential(input) {
5
+ /**
6
+ * Returns the normalized public continuity aliases for one professional
7
+ * identity VC.
8
+ *
9
+ * The canonical source is:
10
+ * - explicit `sameAs` values when present
11
+ * - otherwise the public employee email
12
+ *
13
+ * When both are present they are merged and deduplicated after normalization.
14
+ *
15
+ * @param input Professional identity source values.
16
+ */
17
+ export function getProfessionalIdentitySameAs(input) {
18
+ const sameAsCandidates = [];
19
+ if (input.sameAs) {
20
+ sameAsCandidates.push(...normalizeSameAsHashList(input.sameAs));
21
+ }
22
+ if (input.email) {
23
+ sameAsCandidates.push(...normalizeSameAsHashList(input.email));
24
+ }
25
+ return [...new Set(sameAsCandidates)];
26
+ }
27
+ /**
28
+ * Returns the normalized public telephone continuity value for one
29
+ * professional identity VC.
30
+ *
31
+ * Telephone continuity is kept separate from `sameAs` so callers can reuse
32
+ * ICA-compatible hashing without overloading the public alias slot.
33
+ *
34
+ * @param input Professional identity source values.
35
+ */
36
+ export function getProfessionalIdentityTelephone(input) {
37
+ const normalized = normalizeTelephoneHash(String(input.telephone || ''));
38
+ return normalized || undefined;
39
+ }
40
+ /**
41
+ * Builds the canonical professional identity VC payload reused by SMART VP
42
+ * token helpers and higher SDK facades.
43
+ *
44
+ * Current projection rules:
45
+ * - `credentialSubject.sameAs` stores one CSV string to preserve compatibility
46
+ * with the current flat/shared claim style
47
+ * - `credentialSubject.telephone` stores the hashed public phone continuity
48
+ * value when present
49
+ * - `credentialSubject.hasCredential.material` carries the public signing/bind
50
+ * material when present
51
+ *
52
+ * @param input Professional identity source values.
53
+ */
54
+ export function getProfessionalIdentityVC(input) {
55
+ const normalizedSameAs = getProfessionalIdentitySameAs(input);
56
+ const normalizedTelephone = getProfessionalIdentityTelephone(input);
57
+ const normalizedCredentialMaterial = String(input.credentialMaterial || '').trim();
58
+ const canonicalCredentialSubject = {
59
+ id: String(input.actorDid || '').trim(),
60
+ hasOccupation: String(input.role || '').trim(),
61
+ ...(normalizedSameAs.length
62
+ ? { sameAs: normalizeSameAsHashCsv(normalizedSameAs) }
63
+ : {}),
64
+ ...(normalizedTelephone
65
+ ? { [ClaimsPersonSchemaorg.telephone]: normalizedTelephone }
66
+ : {}),
67
+ ...(normalizedCredentialMaterial
68
+ ? { [ClaimsPersonSchemaorg.hasCredentialMaterial]: normalizedCredentialMaterial }
69
+ : {}),
70
+ };
4
71
  return {
5
72
  type: [
6
73
  W3cCredentialTypes.VerifiableCredential,
7
74
  ProfessionalCredentialTypes.EmployeeCredential,
8
75
  ],
9
76
  credentialSubject: {
10
- id: String(input.actorDid || '').trim(),
11
- hasOccupation: String(input.role || '').trim(),
77
+ ...canonicalCredentialSubject,
12
78
  ...(input.additionalCredentialSubject || {}),
13
79
  },
14
80
  ...(input.additionalCredential || {}),
15
81
  };
16
82
  }
83
+ /**
84
+ * Backwards-compatible alias kept for existing SMART demo callers.
85
+ *
86
+ * @param input Professional identity source values.
87
+ */
88
+ export function buildProfessionalEmployeeCredential(input) {
89
+ return getProfessionalIdentityVC(input);
90
+ }
91
+ /**
92
+ * Builds one SMART/OpenID4VP payload for the current professional identity
93
+ * contract.
94
+ *
95
+ * When no credential is supplied explicitly, the payload embeds the canonical
96
+ * professional identity VC built from the current actor identity input.
97
+ *
98
+ * @param input SMART/OpenID4VP actor payload input.
99
+ */
17
100
  export function buildProfessionalSmartVpPayload(input) {
18
101
  const credentials = Array.isArray(input.verifiableCredential)
19
102
  ? [...input.verifiableCredential]
20
103
  : input.verifiableCredential
21
104
  ? [input.verifiableCredential]
22
- : [buildProfessionalEmployeeCredential({
105
+ : [getProfessionalIdentityVC({
23
106
  actorDid: input.actorDid,
24
107
  role: input.role,
108
+ email: input.email,
109
+ sameAs: input.sameAs,
110
+ telephone: input.telephone,
111
+ credentialMaterial: input.credentialMaterial,
25
112
  })];
26
113
  return {
27
114
  ...(input.additionalPayload || {}),
@@ -32,6 +119,33 @@ export function buildProfessionalSmartVpPayload(input) {
32
119
  },
33
120
  };
34
121
  }
122
+ /**
123
+ * Alias that makes the VC/VP naming more explicit for consumers that want one
124
+ * identity-oriented surface rather than the historical SMART-specific helper
125
+ * names.
126
+ *
127
+ * @param input SMART/OpenID4VP actor payload input.
128
+ */
129
+ export function buildProfessionalIdentityVpPayload(input) {
130
+ return buildProfessionalSmartVpPayload(input);
131
+ }
132
+ /**
133
+ * Builds one unsigned compact VP JWT for the canonical professional identity
134
+ * payload.
135
+ *
136
+ * @param input SMART/OpenID4VP actor payload input.
137
+ * @param options Optional unsigned JWT timing controls.
138
+ */
35
139
  export function buildUnsignedProfessionalSmartVpJwt(input, options = {}) {
36
140
  return buildUnsignedVpJwt(buildProfessionalSmartVpPayload(input), options);
37
141
  }
142
+ /**
143
+ * Alias that makes the unsigned identity VP helper explicit for shared SDK
144
+ * facades.
145
+ *
146
+ * @param input SMART/OpenID4VP actor payload input.
147
+ * @param options Optional unsigned JWT timing controls.
148
+ */
149
+ export function buildUnsignedProfessionalIdentityVpJwt(input, options = {}) {
150
+ return buildUnsignedProfessionalSmartVpJwt(input, options);
151
+ }
@@ -32,6 +32,46 @@ export declare function multibase58MultihashSha3_256(value: string): string;
32
32
  * @param value Email, phone, DID, URN, or any other public alias string.
33
33
  */
34
34
  export declare function normalizeSameAsHash(value: string): string;
35
+ /**
36
+ * Normalizes one or more `sameAs` aliases into one deduplicated array.
37
+ *
38
+ * Input forms:
39
+ * - one plain string
40
+ * - one CSV string
41
+ * - one array of plain/CSV strings
42
+ *
43
+ * Normalization rules:
44
+ * - whitespace-only entries are discarded
45
+ * - emails are hashed into ICA-compatible `urn:multibase:z...`
46
+ * - already-normalized `urn:multibase:z...` values are preserved
47
+ * - duplicate normalized entries are removed while preserving order
48
+ *
49
+ * @param value Canonical sameAs source value(s).
50
+ */
51
+ export declare function normalizeSameAsHashList(value: string | readonly string[] | undefined): string[];
52
+ /**
53
+ * Joins one or more normalized `sameAs` aliases into the current flat CSV
54
+ * storage form used by some shared VC/profile helpers.
55
+ *
56
+ * @param value Canonical sameAs source value(s).
57
+ */
58
+ export declare function normalizeSameAsHashCsv(value: string | readonly string[] | undefined): string;
59
+ /**
60
+ * Normalizes one public telephone alias into the same hashed
61
+ * `urn:multibase:z...` representation used for ICA-compatible public
62
+ * continuity identifiers, while keeping the telephone claim separate from
63
+ * `sameAs`.
64
+ *
65
+ * Rules:
66
+ * - empty input becomes `''`
67
+ * - `urn:multibase:z...` stays unchanged
68
+ * - bare `z...` becomes `urn:multibase:z...`
69
+ * - plain phone-like values are compacted through `normalizePhone(...)`
70
+ * before hashing
71
+ *
72
+ * @param value Plain or already-normalized public telephone alias.
73
+ */
74
+ export declare function normalizeTelephoneHash(value: string): string;
35
75
  /**
36
76
  * Compares two public controller aliases after ICA-compatible normalization.
37
77
  *