gdc-common-utils-ts 2.0.12 → 2.0.14

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 (89) hide show
  1. package/README.md +6 -2
  2. package/dist/examples/employee.d.ts +9 -1
  3. package/dist/examples/employee.js +7 -4
  4. package/dist/examples/shared.d.ts +1 -1
  5. package/dist/examples/shared.js +6 -2
  6. package/dist/utils/actor.d.ts +3 -1
  7. package/dist/utils/medication-claim-helpers.d.ts +5 -85
  8. package/dist/utils/medication-claim-helpers.js +5 -255
  9. package/package.json +1 -5
  10. package/dist/examples/communication-bundle-session.d.ts +0 -22
  11. package/dist/examples/communication-bundle-session.js +0 -79
  12. package/dist/interfaces/IWallet.d.ts +0 -55
  13. package/dist/interfaces/IWallet.js +0 -3
  14. package/dist/models/fhir-related-person.d.ts +0 -61
  15. package/dist/models/fhir-related-person.js +0 -108
  16. package/dist/models/related-profile.d.ts +0 -42
  17. package/dist/models/related-profile.js +0 -16
  18. package/dist/utils/allergy-intolerance-claim-helpers.d.ts +0 -10
  19. package/dist/utils/allergy-intolerance-claim-helpers.js +0 -47
  20. package/dist/utils/appointment-claim-helpers.d.ts +0 -10
  21. package/dist/utils/appointment-claim-helpers.js +0 -26
  22. package/dist/utils/appointment-response-claim-helpers.d.ts +0 -8
  23. package/dist/utils/appointment-response-claim-helpers.js +0 -20
  24. package/dist/utils/claim-list-helpers.d.ts +0 -21
  25. package/dist/utils/claim-list-helpers.js +0 -50
  26. package/dist/utils/clinical-impression-claim-helpers.d.ts +0 -10
  27. package/dist/utils/clinical-impression-claim-helpers.js +0 -26
  28. package/dist/utils/communication-bundle-session.d.ts +0 -175
  29. package/dist/utils/communication-bundle-session.js +0 -524
  30. package/dist/utils/composition-claim-helpers.d.ts +0 -12
  31. package/dist/utils/composition-claim-helpers.js +0 -32
  32. package/dist/utils/condition-claim-helpers.d.ts +0 -10
  33. package/dist/utils/condition-claim-helpers.js +0 -47
  34. package/dist/utils/convert-allergy-intolerance.d.ts +0 -3
  35. package/dist/utils/convert-allergy-intolerance.js +0 -34
  36. package/dist/utils/convert-appointment-response.d.ts +0 -3
  37. package/dist/utils/convert-appointment-response.js +0 -32
  38. package/dist/utils/convert-appointment.d.ts +0 -3
  39. package/dist/utils/convert-appointment.js +0 -61
  40. package/dist/utils/convert-care-plan.d.ts +0 -3
  41. package/dist/utils/convert-care-plan.js +0 -58
  42. package/dist/utils/convert-clinical-impression.d.ts +0 -3
  43. package/dist/utils/convert-clinical-impression.js +0 -42
  44. package/dist/utils/convert-composition.d.ts +0 -3
  45. package/dist/utils/convert-composition.js +0 -35
  46. package/dist/utils/convert-condition.d.ts +0 -3
  47. package/dist/utils/convert-condition.js +0 -24
  48. package/dist/utils/convert-coverage.d.ts +0 -3
  49. package/dist/utils/convert-coverage.js +0 -51
  50. package/dist/utils/convert-device-use-statement.d.ts +0 -3
  51. package/dist/utils/convert-device-use-statement.js +0 -28
  52. package/dist/utils/convert-device.d.ts +0 -3
  53. package/dist/utils/convert-device.js +0 -37
  54. package/dist/utils/convert-diagnostic-report.d.ts +0 -3
  55. package/dist/utils/convert-diagnostic-report.js +0 -55
  56. package/dist/utils/convert-document-reference.d.ts +0 -3
  57. package/dist/utils/convert-document-reference.js +0 -35
  58. package/dist/utils/convert-encounter.d.ts +0 -3
  59. package/dist/utils/convert-encounter.js +0 -68
  60. package/dist/utils/convert-flag.d.ts +0 -3
  61. package/dist/utils/convert-flag.js +0 -34
  62. package/dist/utils/convert-immunization.d.ts +0 -3
  63. package/dist/utils/convert-immunization.js +0 -56
  64. package/dist/utils/convert-medication-statement.d.ts +0 -3
  65. package/dist/utils/convert-medication-statement.js +0 -64
  66. package/dist/utils/convert-observation.d.ts +0 -3
  67. package/dist/utils/convert-observation.js +0 -57
  68. package/dist/utils/convert-procedure.d.ts +0 -3
  69. package/dist/utils/convert-procedure.js +0 -50
  70. package/dist/utils/convert-related-person.d.ts +0 -3
  71. package/dist/utils/convert-related-person.js +0 -31
  72. package/dist/utils/convert-shared.d.ts +0 -34
  73. package/dist/utils/convert-shared.js +0 -179
  74. package/dist/utils/coverage-claim-helpers.d.ts +0 -10
  75. package/dist/utils/coverage-claim-helpers.js +0 -26
  76. package/dist/utils/diagnostic-report-claim-helpers.d.ts +0 -12
  77. package/dist/utils/diagnostic-report-claim-helpers.js +0 -32
  78. package/dist/utils/employee-editor.d.ts +0 -24
  79. package/dist/utils/employee-editor.js +0 -41
  80. package/dist/utils/encounter-claim-helpers.d.ts +0 -10
  81. package/dist/utils/encounter-claim-helpers.js +0 -26
  82. package/dist/utils/gateway-index-params.d.ts +0 -44
  83. package/dist/utils/gateway-index-params.js +0 -80
  84. package/dist/utils/normalize-subject-uuid.d.ts +0 -1
  85. package/dist/utils/normalize-subject-uuid.js +0 -24
  86. package/dist/utils/related-person-claim-helpers.d.ts +0 -8
  87. package/dist/utils/related-person-claim-helpers.js +0 -20
  88. package/dist/utils/search-parameter-catalog.d.ts +0 -31
  89. package/dist/utils/search-parameter-catalog.js +0 -81
@@ -1,179 +0,0 @@
1
- // Copyright 2026 Conéctate Soluciones y Aplicaciones SL under the Apache License, Version 2.0.
2
- // File: src/utils/convert-shared.ts
3
- export function isPlainObject(value) {
4
- return Boolean(value) && typeof value === 'object' && !Array.isArray(value);
5
- }
6
- export function codingFromValue(value) {
7
- if (!value)
8
- return undefined;
9
- const [system, code] = value.split('|');
10
- if (!code)
11
- return [{ code: system }];
12
- return [{ system, code }];
13
- }
14
- export function codingToValue(coding) {
15
- if (!coding?.code)
16
- return undefined;
17
- return coding.system ? `${coding.system}|${coding.code}` : coding.code;
18
- }
19
- export function referenceToValue(reference) {
20
- return reference?.reference;
21
- }
22
- export function referenceListToCsv(references) {
23
- const values = (references || [])
24
- .map((item) => item?.reference)
25
- .filter((item) => Boolean(item));
26
- return values.length ? values.join(',') : undefined;
27
- }
28
- export function codingListToCsv(codings) {
29
- const values = (codings || [])
30
- .map((item) => codingToValue(item))
31
- .filter((item) => Boolean(item));
32
- return values.length ? values.join(',') : undefined;
33
- }
34
- export function requireClaim(claims, key) {
35
- const value = claims[key];
36
- if (!value)
37
- throw new Error(`Missing required claim: ${key}`);
38
- return value;
39
- }
40
- export function requireSubjectIdentifier(value, key) {
41
- if (!value.startsWith('urn:') && !value.startsWith('did:web:')) {
42
- throw new Error(`Invalid ${key}: expected urn:* or did:web:*`);
43
- }
44
- }
45
- export function requireDidWeb(value, key) {
46
- if (!value.startsWith('did:web:')) {
47
- throw new Error(`Invalid ${key}: expected did:web:*`);
48
- }
49
- }
50
- function stringifyClaimLeaf(value) {
51
- if (value === undefined || value === null)
52
- return undefined;
53
- if (typeof value === 'string')
54
- return value;
55
- if (typeof value === 'number' || typeof value === 'boolean')
56
- return String(value);
57
- return undefined;
58
- }
59
- function flattenClaimPath(prefix, value, out) {
60
- const primitive = stringifyClaimLeaf(value);
61
- if (primitive !== undefined) {
62
- out[prefix] = primitive;
63
- if (typeof value === 'number' || typeof value === 'boolean') {
64
- out[`${prefix}#type`] = typeof value;
65
- }
66
- return;
67
- }
68
- if (Array.isArray(value)) {
69
- value.forEach((entry, index) => {
70
- flattenClaimPath(`${prefix}[${index}]`, entry, out);
71
- });
72
- return;
73
- }
74
- if (isPlainObject(value)) {
75
- for (const [key, nestedValue] of Object.entries(value)) {
76
- if (key === 'meta' && isPlainObject(nestedValue) && 'claims' in nestedValue) {
77
- const nestedMeta = { ...nestedValue };
78
- delete nestedMeta.claims;
79
- if (Object.keys(nestedMeta).length === 0)
80
- continue;
81
- flattenClaimPath(`${prefix}.${key}`, nestedMeta, out);
82
- continue;
83
- }
84
- flattenClaimPath(`${prefix}.${key}`, nestedValue, out);
85
- }
86
- }
87
- }
88
- function parseClaimPath(path) {
89
- const segments = [];
90
- const re = /([^[.\]]+)|\[(\d+)\]/g;
91
- let match;
92
- while ((match = re.exec(path)) !== null) {
93
- if (match[1])
94
- segments.push(match[1]);
95
- else if (match[2])
96
- segments.push(Number(match[2]));
97
- }
98
- return segments;
99
- }
100
- function coerceClaimLeaf(value, typeHint) {
101
- if (typeHint === 'boolean')
102
- return value === 'true';
103
- if (typeHint === 'number')
104
- return Number(value);
105
- return value;
106
- }
107
- function assignInflatedPath(target, path, value, typeHint) {
108
- const segments = parseClaimPath(path);
109
- if (segments.length === 0)
110
- return;
111
- let cursor = target;
112
- for (let index = 0; index < segments.length; index += 1) {
113
- const segment = segments[index];
114
- const nextSegment = segments[index + 1];
115
- const isLast = index === segments.length - 1;
116
- if (typeof segment === 'number') {
117
- if (!Array.isArray(cursor))
118
- return;
119
- if (isLast) {
120
- cursor[segment] = coerceClaimLeaf(value, typeHint);
121
- return;
122
- }
123
- if (cursor[segment] === undefined)
124
- cursor[segment] = typeof nextSegment === 'number' ? [] : {};
125
- cursor = cursor[segment];
126
- continue;
127
- }
128
- if (!isPlainObject(cursor))
129
- return;
130
- if (isLast) {
131
- cursor[segment] = coerceClaimLeaf(value, typeHint);
132
- return;
133
- }
134
- if (cursor[segment] === undefined)
135
- cursor[segment] = typeof nextSegment === 'number' ? [] : {};
136
- cursor = cursor[segment];
137
- }
138
- }
139
- /**
140
- * Generic structural fallback for unsupported resources.
141
- */
142
- export function fhirResourceToFlatClaims(resource, context = 'org.hl7.fhir.r4') {
143
- if (!resource?.resourceType) {
144
- throw new Error('FHIR resource must define resourceType.');
145
- }
146
- const out = { '@context': context };
147
- for (const [key, value] of Object.entries(resource)) {
148
- if (key === 'resourceType')
149
- continue;
150
- flattenClaimPath(`${resource.resourceType}.${key}`, value, out);
151
- }
152
- return out;
153
- }
154
- /**
155
- * Generic structural regeneration for unsupported resources.
156
- */
157
- export function flatClaimsToFhirResource(claims) {
158
- const typeHints = new Map();
159
- for (const [key, value] of Object.entries(claims || {})) {
160
- if (key.endsWith('#type') && typeof value === 'string') {
161
- typeHints.set(key.slice(0, -5), value);
162
- }
163
- }
164
- const entries = Object.entries(claims || {}).filter(([key, value]) => key !== '@context' && !key.endsWith('#type') && value !== undefined);
165
- const firstClaimKey = entries[0]?.[0];
166
- if (!firstClaimKey || !firstClaimKey.includes('.')) {
167
- throw new Error('Flat claims must contain at least one contextualized resource claim.');
168
- }
169
- const resourceType = firstClaimKey.split('.')[0];
170
- const resource = { resourceType };
171
- for (const [key, value] of entries) {
172
- if (typeof value !== 'string')
173
- continue;
174
- if (!key.startsWith(`${resourceType}.`))
175
- continue;
176
- assignInflatedPath(resource, key.slice(resourceType.length + 1), value, typeHints.get(key));
177
- }
178
- return resource;
179
- }
@@ -1,10 +0,0 @@
1
- import { type GenericInteroperableClaims } from './claim-list-helpers.js';
2
- export type CoverageInteroperableClaims = GenericInteroperableClaims;
3
- export declare function getCoverageClaimList(claims: CoverageInteroperableClaims, claimKey: string): string[];
4
- export declare function setCoverageClaimList(claims: CoverageInteroperableClaims, claimKey: string, values: string | readonly string[]): CoverageInteroperableClaims;
5
- export declare function addCoverageClaimList(claims: CoverageInteroperableClaims, claimKey: string, values: string | readonly string[]): CoverageInteroperableClaims;
6
- export declare function removeCoverageClaimList(claims: CoverageInteroperableClaims, claimKey: string, values: string | readonly string[]): CoverageInteroperableClaims;
7
- export declare function getCoverageIdentifier(claims: CoverageInteroperableClaims): string;
8
- export declare function setCoverageIdentifier(claims: CoverageInteroperableClaims, value: string): CoverageInteroperableClaims;
9
- export declare function getCoveragePayorList(claims: CoverageInteroperableClaims): string[];
10
- export declare function setCoveragePayorList(claims: CoverageInteroperableClaims, values: string | readonly string[]): CoverageInteroperableClaims;
@@ -1,26 +0,0 @@
1
- import { CoverageClaim } from '../models/interoperable-claims/coverage-claims.js';
2
- import { addClaimValues, getClaimValues, normalizeClaimScalar, removeClaimValues, setClaimValues, } from './claim-list-helpers.js';
3
- export function getCoverageClaimList(claims, claimKey) {
4
- return getClaimValues(claims, claimKey);
5
- }
6
- export function setCoverageClaimList(claims, claimKey, values) {
7
- return setClaimValues(claims, claimKey, values);
8
- }
9
- export function addCoverageClaimList(claims, claimKey, values) {
10
- return addClaimValues(claims, claimKey, values);
11
- }
12
- export function removeCoverageClaimList(claims, claimKey, values) {
13
- return removeClaimValues(claims, claimKey, values);
14
- }
15
- export function getCoverageIdentifier(claims) {
16
- return normalizeClaimScalar(claims[CoverageClaim.Identifier]);
17
- }
18
- export function setCoverageIdentifier(claims, value) {
19
- return { ...claims, [CoverageClaim.Identifier]: normalizeClaimScalar(value) };
20
- }
21
- export function getCoveragePayorList(claims) {
22
- return getCoverageClaimList(claims, CoverageClaim.Payor);
23
- }
24
- export function setCoveragePayorList(claims, values) {
25
- return setCoverageClaimList(claims, CoverageClaim.Payor, values);
26
- }
@@ -1,12 +0,0 @@
1
- import { type GenericInteroperableClaims } from './claim-list-helpers.js';
2
- export type DiagnosticReportInteroperableClaims = GenericInteroperableClaims;
3
- export declare function getDiagnosticReportClaimList(claims: DiagnosticReportInteroperableClaims, claimKey: string): string[];
4
- export declare function setDiagnosticReportClaimList(claims: DiagnosticReportInteroperableClaims, claimKey: string, values: string | readonly string[]): DiagnosticReportInteroperableClaims;
5
- export declare function addDiagnosticReportClaimList(claims: DiagnosticReportInteroperableClaims, claimKey: string, values: string | readonly string[]): DiagnosticReportInteroperableClaims;
6
- export declare function removeDiagnosticReportClaimList(claims: DiagnosticReportInteroperableClaims, claimKey: string, values: string | readonly string[]): DiagnosticReportInteroperableClaims;
7
- export declare function getDiagnosticReportIdentifier(claims: DiagnosticReportInteroperableClaims): string;
8
- export declare function setDiagnosticReportIdentifier(claims: DiagnosticReportInteroperableClaims, value: string): DiagnosticReportInteroperableClaims;
9
- export declare function getDiagnosticReportResultList(claims: DiagnosticReportInteroperableClaims): string[];
10
- export declare function setDiagnosticReportResultList(claims: DiagnosticReportInteroperableClaims, values: string | readonly string[]): DiagnosticReportInteroperableClaims;
11
- export declare function getDiagnosticReportContainedDocumentIdentifierList(claims: DiagnosticReportInteroperableClaims): string[];
12
- export declare function setDiagnosticReportContainedDocumentIdentifierList(claims: DiagnosticReportInteroperableClaims, values: string | readonly string[]): DiagnosticReportInteroperableClaims;
@@ -1,32 +0,0 @@
1
- import { DiagnosticReportClaim } from '../models/interoperable-claims/diagnostic-report-claims.js';
2
- import { addClaimValues, getClaimValues, normalizeClaimScalar, removeClaimValues, setClaimValues, } from './claim-list-helpers.js';
3
- export function getDiagnosticReportClaimList(claims, claimKey) {
4
- return getClaimValues(claims, claimKey);
5
- }
6
- export function setDiagnosticReportClaimList(claims, claimKey, values) {
7
- return setClaimValues(claims, claimKey, values);
8
- }
9
- export function addDiagnosticReportClaimList(claims, claimKey, values) {
10
- return addClaimValues(claims, claimKey, values);
11
- }
12
- export function removeDiagnosticReportClaimList(claims, claimKey, values) {
13
- return removeClaimValues(claims, claimKey, values);
14
- }
15
- export function getDiagnosticReportIdentifier(claims) {
16
- return normalizeClaimScalar(claims[DiagnosticReportClaim.Identifier]);
17
- }
18
- export function setDiagnosticReportIdentifier(claims, value) {
19
- return { ...claims, [DiagnosticReportClaim.Identifier]: normalizeClaimScalar(value) };
20
- }
21
- export function getDiagnosticReportResultList(claims) {
22
- return getDiagnosticReportClaimList(claims, DiagnosticReportClaim.Result);
23
- }
24
- export function setDiagnosticReportResultList(claims, values) {
25
- return setDiagnosticReportClaimList(claims, DiagnosticReportClaim.Result, values);
26
- }
27
- export function getDiagnosticReportContainedDocumentIdentifierList(claims) {
28
- return getDiagnosticReportClaimList(claims, DiagnosticReportClaim.ContainedDocuments);
29
- }
30
- export function setDiagnosticReportContainedDocumentIdentifierList(claims, values) {
31
- return setDiagnosticReportClaimList(claims, DiagnosticReportClaim.ContainedDocuments, values);
32
- }
@@ -1,24 +0,0 @@
1
- import { BundleEditor } from './bundle-editor';
2
- /**
3
- * High-level employee adapter on top of the shared `BundleEditor`.
4
- *
5
- * Use this class when the active bundle entry is known to represent one
6
- * employee resource and callers should work with employee semantics instead of
7
- * raw claim keys.
8
- */
9
- export declare class EmployeeEditor extends BundleEditor {
10
- /** Writes the canonical employee email claim on the active entry. */
11
- setEmail(email: string): this;
12
- /** Reads the canonical employee email claim from the active entry. */
13
- getEmail(): string | undefined;
14
- /** Writes the canonical employee occupational role claim on the active entry. */
15
- setRole(role: string): this;
16
- /** Reads the canonical employee occupational role claim from the active entry. */
17
- getRole(): string | undefined;
18
- /** Writes the canonical employee `worksFor` claim on the active entry. */
19
- setWorksFor(worksFor: string): this;
20
- /** Writes the canonical employee `memberOf` claim on the active entry. */
21
- setMemberOf(memberOf: string): this;
22
- /** Writes the canonical employee organization tax id claim on the active entry. */
23
- setMemberOfOrgTaxId(taxId: string): this;
24
- }
@@ -1,41 +0,0 @@
1
- import { ClaimsPersonSchemaorg } from '../constants/schemaorg.js';
2
- import { BundleEditor } from './bundle-editor.js';
3
- /**
4
- * High-level employee adapter on top of the shared `BundleEditor`.
5
- *
6
- * Use this class when the active bundle entry is known to represent one
7
- * employee resource and callers should work with employee semantics instead of
8
- * raw claim keys.
9
- */
10
- export class EmployeeEditor extends BundleEditor {
11
- /** Writes the canonical employee email claim on the active entry. */
12
- setEmail(email) {
13
- return this.setClaim(ClaimsPersonSchemaorg.email, String(email).trim());
14
- }
15
- /** Reads the canonical employee email claim from the active entry. */
16
- getEmail() {
17
- const email = this.getClaim(ClaimsPersonSchemaorg.email);
18
- return typeof email === 'string' && email.trim() ? email.trim() : undefined;
19
- }
20
- /** Writes the canonical employee occupational role claim on the active entry. */
21
- setRole(role) {
22
- return this.setClaim(ClaimsPersonSchemaorg.hasOccupationalRoleValue, String(role).trim());
23
- }
24
- /** Reads the canonical employee occupational role claim from the active entry. */
25
- getRole() {
26
- const role = this.getClaim(ClaimsPersonSchemaorg.hasOccupationalRoleValue);
27
- return typeof role === 'string' && role.trim() ? role.trim() : undefined;
28
- }
29
- /** Writes the canonical employee `worksFor` claim on the active entry. */
30
- setWorksFor(worksFor) {
31
- return this.setClaim(ClaimsPersonSchemaorg.worksFor, String(worksFor).trim());
32
- }
33
- /** Writes the canonical employee `memberOf` claim on the active entry. */
34
- setMemberOf(memberOf) {
35
- return this.setClaim(ClaimsPersonSchemaorg.memberOf, String(memberOf).trim());
36
- }
37
- /** Writes the canonical employee organization tax id claim on the active entry. */
38
- setMemberOfOrgTaxId(taxId) {
39
- return this.setClaim(ClaimsPersonSchemaorg.memberOfOrgTaxId, String(taxId).trim());
40
- }
41
- }
@@ -1,10 +0,0 @@
1
- import { type GenericInteroperableClaims } from './claim-list-helpers.js';
2
- export type EncounterInteroperableClaims = GenericInteroperableClaims;
3
- export declare function getEncounterClaimList(claims: EncounterInteroperableClaims, claimKey: string): string[];
4
- export declare function setEncounterClaimList(claims: EncounterInteroperableClaims, claimKey: string, values: string | readonly string[]): EncounterInteroperableClaims;
5
- export declare function addEncounterClaimList(claims: EncounterInteroperableClaims, claimKey: string, values: string | readonly string[]): EncounterInteroperableClaims;
6
- export declare function removeEncounterClaimList(claims: EncounterInteroperableClaims, claimKey: string, values: string | readonly string[]): EncounterInteroperableClaims;
7
- export declare function getEncounterIdentifier(claims: EncounterInteroperableClaims): string;
8
- export declare function setEncounterIdentifier(claims: EncounterInteroperableClaims, value: string): EncounterInteroperableClaims;
9
- export declare function getEncounterParticipantList(claims: EncounterInteroperableClaims): string[];
10
- export declare function setEncounterParticipantList(claims: EncounterInteroperableClaims, values: string | readonly string[]): EncounterInteroperableClaims;
@@ -1,26 +0,0 @@
1
- import { EncounterClaim } from '../models/interoperable-claims/encounter-claims.js';
2
- import { addClaimValues, getClaimValues, normalizeClaimScalar, removeClaimValues, setClaimValues, } from './claim-list-helpers.js';
3
- export function getEncounterClaimList(claims, claimKey) {
4
- return getClaimValues(claims, claimKey);
5
- }
6
- export function setEncounterClaimList(claims, claimKey, values) {
7
- return setClaimValues(claims, claimKey, values);
8
- }
9
- export function addEncounterClaimList(claims, claimKey, values) {
10
- return addClaimValues(claims, claimKey, values);
11
- }
12
- export function removeEncounterClaimList(claims, claimKey, values) {
13
- return removeClaimValues(claims, claimKey, values);
14
- }
15
- export function getEncounterIdentifier(claims) {
16
- return normalizeClaimScalar(claims[EncounterClaim.Identifier]);
17
- }
18
- export function setEncounterIdentifier(claims, value) {
19
- return { ...claims, [EncounterClaim.Identifier]: normalizeClaimScalar(value) };
20
- }
21
- export function getEncounterParticipantList(claims) {
22
- return getEncounterClaimList(claims, EncounterClaim.Participant);
23
- }
24
- export function setEncounterParticipantList(claims, values) {
25
- return setEncounterClaimList(claims, EncounterClaim.Participant, values);
26
- }
@@ -1,44 +0,0 @@
1
- /**
2
- * @fileoverview Shared internal index-parameter builders used by GW managers.
3
- *
4
- * @architecture 101
5
- * These helpers are not public FHIR search catalogs. They encapsulate internal
6
- * blind-query index shapes already shared across multiple GW managers.
7
- */
8
- import type { ParameterData } from '../models/params';
9
- import type { ClaimsRecord } from '../models/resource-document';
10
- /**
11
- * Internal blind-query attribute names shared by employee/controller records.
12
- */
13
- export declare enum GatewayEmployeeIndexAttributeName {
14
- Email = "email",
15
- Role = "role",
16
- Kid = "kid"
17
- }
18
- type EmployeeIdentityIndexInput = Readonly<{
19
- email?: string;
20
- roleCode?: string;
21
- kidValues?: readonly string[];
22
- }>;
23
- /**
24
- * Builds the canonical blind-query index set for employee/controller records.
25
- *
26
- * `roleCode` is expected to be already normalized by the caller.
27
- *
28
- * @param input - Concrete employee/controller identity values.
29
- * @returns Concrete `ParameterData[]` entries ready for HMAC protection.
30
- */
31
- export declare function buildEmployeeIdentityIndexParameters(input: EmployeeIdentityIndexInput): ParameterData[];
32
- /**
33
- * Materializes concrete index parameters from a shared flat-claim definition list.
34
- *
35
- * The returned entries keep the original definition metadata (`type`, `unique`)
36
- * and only replace `value` with the concrete scalar from the claims object when
37
- * present.
38
- *
39
- * @param claims - Flat claims object to read from.
40
- * @param definitions - Shared parameter definitions.
41
- * @returns Concrete entries with populated values only.
42
- */
43
- export declare function buildClaimIndexParametersFromDefinitionList(claims: ClaimsRecord, definitions: readonly ParameterData[]): ParameterData[];
44
- export {};
@@ -1,80 +0,0 @@
1
- // Copyright 2026 Antifraud Services Inc. under the Apache License, Version 2.0.
2
- /**
3
- * @fileoverview Shared internal index-parameter builders used by GW managers.
4
- *
5
- * @architecture 101
6
- * These helpers are not public FHIR search catalogs. They encapsulate internal
7
- * blind-query index shapes already shared across multiple GW managers.
8
- */
9
- /**
10
- * Internal blind-query attribute names shared by employee/controller records.
11
- */
12
- export var GatewayEmployeeIndexAttributeName;
13
- (function (GatewayEmployeeIndexAttributeName) {
14
- GatewayEmployeeIndexAttributeName["Email"] = "email";
15
- GatewayEmployeeIndexAttributeName["Role"] = "role";
16
- GatewayEmployeeIndexAttributeName["Kid"] = "kid";
17
- })(GatewayEmployeeIndexAttributeName || (GatewayEmployeeIndexAttributeName = {}));
18
- /**
19
- * Builds the canonical blind-query index set for employee/controller records.
20
- *
21
- * `roleCode` is expected to be already normalized by the caller.
22
- *
23
- * @param input - Concrete employee/controller identity values.
24
- * @returns Concrete `ParameterData[]` entries ready for HMAC protection.
25
- */
26
- export function buildEmployeeIdentityIndexParameters(input) {
27
- const parameters = [];
28
- if (typeof input.email === 'string' && input.email.trim().length > 0) {
29
- parameters.push({
30
- name: GatewayEmployeeIndexAttributeName.Email,
31
- value: input.email.trim(),
32
- unique: true,
33
- type: 'string',
34
- });
35
- }
36
- if (typeof input.roleCode === 'string' && input.roleCode.trim().length > 0) {
37
- parameters.push({
38
- name: GatewayEmployeeIndexAttributeName.Role,
39
- value: input.roleCode.trim(),
40
- unique: false,
41
- type: 'token',
42
- });
43
- }
44
- for (const kid of input.kidValues || []) {
45
- if (typeof kid !== 'string' || kid.trim().length === 0)
46
- continue;
47
- parameters.push({
48
- name: GatewayEmployeeIndexAttributeName.Kid,
49
- value: kid.trim(),
50
- unique: false,
51
- type: 'string',
52
- });
53
- }
54
- return parameters;
55
- }
56
- /**
57
- * Materializes concrete index parameters from a shared flat-claim definition list.
58
- *
59
- * The returned entries keep the original definition metadata (`type`, `unique`)
60
- * and only replace `value` with the concrete scalar from the claims object when
61
- * present.
62
- *
63
- * @param claims - Flat claims object to read from.
64
- * @param definitions - Shared parameter definitions.
65
- * @returns Concrete entries with populated values only.
66
- */
67
- export function buildClaimIndexParametersFromDefinitionList(claims, definitions) {
68
- const parameters = [];
69
- for (const definition of definitions) {
70
- const rawValue = claims[definition.name];
71
- if (typeof rawValue !== 'string' && typeof rawValue !== 'number') {
72
- continue;
73
- }
74
- parameters.push({
75
- ...definition,
76
- value: rawValue,
77
- });
78
- }
79
- return parameters;
80
- }
@@ -1 +0,0 @@
1
- export declare function normalizeSubjectUuid(input: string | undefined): string | undefined;
@@ -1,24 +0,0 @@
1
- // Normalizes a subject identifier to a canonical UUID (hexadecimal, lowercase, no dashes)
2
- // Accepts: urn:uuid:<uuid>, <ResourceType>/<uuid>, <uuid> (with or without dashes), base58 (optional)
3
- // Returns: canonical hex string (no dashes, lowercase) or undefined if not valid
4
- export function normalizeSubjectUuid(input) {
5
- if (!input)
6
- return undefined;
7
- let s = String(input).trim();
8
- // urn:uuid:<uuid>
9
- if (s.startsWith('urn:uuid:'))
10
- s = s.slice(9);
11
- // <ResourceType>/<uuid>
12
- const slashIdx = s.indexOf('/');
13
- if (slashIdx >= 0)
14
- s = s.slice(slashIdx + 1);
15
- // Remove dashes
16
- s = s.replace(/-/g, '');
17
- // Lowercase
18
- s = s.toLowerCase();
19
- // Validate: must be 32 hex chars
20
- if (/^[0-9a-f]{32}$/.test(s))
21
- return s;
22
- // Optionally: add base58 or other formats here
23
- return undefined;
24
- }
@@ -1,8 +0,0 @@
1
- import { type GenericInteroperableClaims } from './claim-list-helpers.js';
2
- export type RelatedPersonInteroperableClaims = GenericInteroperableClaims;
3
- export declare function getRelatedPersonClaimList(claims: RelatedPersonInteroperableClaims, claimKey: string): string[];
4
- export declare function setRelatedPersonClaimList(claims: RelatedPersonInteroperableClaims, claimKey: string, values: string | readonly string[]): RelatedPersonInteroperableClaims;
5
- export declare function addRelatedPersonClaimList(claims: RelatedPersonInteroperableClaims, claimKey: string, values: string | readonly string[]): RelatedPersonInteroperableClaims;
6
- export declare function removeRelatedPersonClaimList(claims: RelatedPersonInteroperableClaims, claimKey: string, values: string | readonly string[]): RelatedPersonInteroperableClaims;
7
- export declare function getRelatedPersonIdentifier(claims: RelatedPersonInteroperableClaims): string;
8
- export declare function setRelatedPersonIdentifier(claims: RelatedPersonInteroperableClaims, value: string): RelatedPersonInteroperableClaims;
@@ -1,20 +0,0 @@
1
- import { RelatedPersonClaim } from '../models/interoperable-claims/related-person-claims.js';
2
- import { addClaimValues, getClaimValues, normalizeClaimScalar, removeClaimValues, setClaimValues, } from './claim-list-helpers.js';
3
- export function getRelatedPersonClaimList(claims, claimKey) {
4
- return getClaimValues(claims, claimKey);
5
- }
6
- export function setRelatedPersonClaimList(claims, claimKey, values) {
7
- return setClaimValues(claims, claimKey, values);
8
- }
9
- export function addRelatedPersonClaimList(claims, claimKey, values) {
10
- return addClaimValues(claims, claimKey, values);
11
- }
12
- export function removeRelatedPersonClaimList(claims, claimKey, values) {
13
- return removeClaimValues(claims, claimKey, values);
14
- }
15
- export function getRelatedPersonIdentifier(claims) {
16
- return normalizeClaimScalar(claims[RelatedPersonClaim.Identifier]);
17
- }
18
- export function setRelatedPersonIdentifier(claims, value) {
19
- return { ...claims, [RelatedPersonClaim.Identifier]: normalizeClaimScalar(value) };
20
- }
@@ -1,31 +0,0 @@
1
- /**
2
- * @fileoverview Helpers for shared search-parameter catalogs.
3
- *
4
- * @architecture 101
5
- * - Search catalogs define the public search surface by resource type.
6
- * - These helpers resolve canonical contextualized claim names plus aliases.
7
- * - GW managers can use the same catalog both for indexing and for future
8
- * `CapabilityStatement.searchParam` generation.
9
- */
10
- import type { ClaimsRecord } from '../models/resource-document';
11
- import type { ParameterData, SearchParameterCatalog, SearchParameterDefinition } from '../models/params';
12
- /**
13
- * Resolves the first populated value for a search parameter definition using its
14
- * canonical claim name followed by any configured aliases.
15
- *
16
- * @param claims - Flat claims object.
17
- * @param definition - Search parameter definition.
18
- * @returns First populated scalar value, if any.
19
- */
20
- export declare function resolveSearchParameterValueFromClaims(claims: ClaimsRecord, definition: SearchParameterDefinition): string | undefined;
21
- /**
22
- * Builds index/query-ready `ParameterData` entries from a shared search catalog.
23
- *
24
- * Only catalog entries marked as indexable, and with a populated value in the
25
- * claims object, are returned.
26
- *
27
- * @param claims - Flat claims object.
28
- * @param catalog - Shared search parameter catalog for a resource type.
29
- * @returns Concrete parameter entries with resolved values.
30
- */
31
- export declare function buildIndexParametersFromSearchCatalog<TSearchName extends string>(claims: ClaimsRecord, catalog: SearchParameterCatalog<TSearchName>): ParameterData[];