gdc-common-utils-ts 1.8.0 → 1.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -139,3 +139,8 @@ export declare enum ICAOIdentityParams {
139
139
  }
140
140
  export declare const indexedPersonAttributeList: string[];
141
141
  export declare const fullPersonParamsSchemaorg: ParameterData[];
142
+ /**
143
+ * Canonical schema.org `Service` flat claims commonly used by GW tenant and
144
+ * individual onboarding flows.
145
+ */
146
+ export declare const fullServiceParamsSchemaorg: ParameterData[];
@@ -224,3 +224,35 @@ export const fullPersonParamsSchemaorg = [
224
224
  },
225
225
  */
226
226
  ];
227
+ /**
228
+ * Canonical schema.org `Service` flat claims commonly used by GW tenant and
229
+ * individual onboarding flows.
230
+ */
231
+ export const fullServiceParamsSchemaorg = [
232
+ {
233
+ name: ClaimsServiceSchemaorg.category,
234
+ type: 'token',
235
+ value: undefined,
236
+ },
237
+ {
238
+ name: ClaimsServiceSchemaorg.identifier,
239
+ type: 'uri',
240
+ value: undefined,
241
+ unique: true,
242
+ },
243
+ {
244
+ name: ClaimsServiceSchemaorg.serviceType,
245
+ type: 'token',
246
+ value: undefined,
247
+ },
248
+ {
249
+ name: ClaimsServiceSchemaorg.termsOfService,
250
+ type: 'uri',
251
+ value: undefined,
252
+ },
253
+ {
254
+ name: ClaimsServiceSchemaorg.url,
255
+ type: 'uri',
256
+ value: undefined,
257
+ },
258
+ ];
@@ -0,0 +1,61 @@
1
+ /**
2
+ * @fileoverview Canonical flat-claim constants for FHIR `RelatedPerson`.
3
+ *
4
+ * @architecture 101
5
+ * - Use exported constants instead of inline claim-name literals.
6
+ * - `ClaimsContextFhirRelatedPerson` models the stable business/search contract.
7
+ * - `RelatedPerson.patient` is kept as a transport/storage compatibility alias for
8
+ * existing R4 payloads, while `RelatedPerson.subject` remains the shared SDK name.
9
+ */
10
+ import type { SearchParameterCatalog } from './params';
11
+ /**
12
+ * Canonical interoperable claims for `RelatedPerson`.
13
+ *
14
+ * The enum follows the established `ResourceType.parameter` shape used by the
15
+ * rest of the flat FHIR claims model.
16
+ */
17
+ export declare enum ClaimsContextFhirRelatedPerson {
18
+ Identifier = "RelatedPerson.identifier",
19
+ Subject = "RelatedPerson.subject",
20
+ Relationship = "RelatedPerson.relationship",
21
+ Name = "RelatedPerson.name",
22
+ Email = "RelatedPerson.email",
23
+ Phone = "RelatedPerson.phone"
24
+ }
25
+ /**
26
+ * Legacy FHIR R4 field name still present in examples and existing stored data.
27
+ *
28
+ * New shared code should normalize from this alias into
29
+ * `ClaimsContextFhirRelatedPerson.Subject` when projecting business DTOs.
30
+ */
31
+ export declare const FHIR_RELATED_PERSON_PATIENT_CLAIM: "RelatedPerson.patient";
32
+ /**
33
+ * Legacy telecom alias preserved for older ingestion payloads.
34
+ */
35
+ export declare const FHIR_RELATED_PERSON_TELECOM_CLAIM: "RelatedPerson.telecom";
36
+ /**
37
+ * Optional lifecycle/status claim used by projections when present.
38
+ */
39
+ export declare const FHIR_RELATED_PERSON_STATUS_CLAIM: "RelatedPerson.status";
40
+ /**
41
+ * Public search parameter names exposed for `RelatedPerson`.
42
+ *
43
+ * These names are independent from the underlying flat claim keys and are the
44
+ * right source for client-side search UIs and future `CapabilityStatement`
45
+ * generation.
46
+ */
47
+ export declare enum RelatedPersonSearchParameterName {
48
+ Identifier = "identifier",
49
+ Subject = "subject",
50
+ Relationship = "relationship",
51
+ Name = "name",
52
+ Email = "email",
53
+ Phone = "phone"
54
+ }
55
+ /**
56
+ * Shared searchable/indexable parameter catalog for `RelatedPerson`.
57
+ *
58
+ * `name` is the canonical flat claim key to index/query. The record key is the
59
+ * public search-attribute name.
60
+ */
61
+ export declare const relatedPersonSearchParameterCatalog: SearchParameterCatalog<RelatedPersonSearchParameterName>;
@@ -0,0 +1,108 @@
1
+ // Copyright 2026 Antifraud Services Inc. under the Apache License, Version 2.0.
2
+ /**
3
+ * @fileoverview Canonical flat-claim constants for FHIR `RelatedPerson`.
4
+ *
5
+ * @architecture 101
6
+ * - Use exported constants instead of inline claim-name literals.
7
+ * - `ClaimsContextFhirRelatedPerson` models the stable business/search contract.
8
+ * - `RelatedPerson.patient` is kept as a transport/storage compatibility alias for
9
+ * existing R4 payloads, while `RelatedPerson.subject` remains the shared SDK name.
10
+ */
11
+ /**
12
+ * Canonical interoperable claims for `RelatedPerson`.
13
+ *
14
+ * The enum follows the established `ResourceType.parameter` shape used by the
15
+ * rest of the flat FHIR claims model.
16
+ */
17
+ export var ClaimsContextFhirRelatedPerson;
18
+ (function (ClaimsContextFhirRelatedPerson) {
19
+ ClaimsContextFhirRelatedPerson["Identifier"] = "RelatedPerson.identifier";
20
+ ClaimsContextFhirRelatedPerson["Subject"] = "RelatedPerson.subject";
21
+ ClaimsContextFhirRelatedPerson["Relationship"] = "RelatedPerson.relationship";
22
+ ClaimsContextFhirRelatedPerson["Name"] = "RelatedPerson.name";
23
+ ClaimsContextFhirRelatedPerson["Email"] = "RelatedPerson.email";
24
+ ClaimsContextFhirRelatedPerson["Phone"] = "RelatedPerson.phone";
25
+ })(ClaimsContextFhirRelatedPerson || (ClaimsContextFhirRelatedPerson = {}));
26
+ /**
27
+ * Legacy FHIR R4 field name still present in examples and existing stored data.
28
+ *
29
+ * New shared code should normalize from this alias into
30
+ * `ClaimsContextFhirRelatedPerson.Subject` when projecting business DTOs.
31
+ */
32
+ export const FHIR_RELATED_PERSON_PATIENT_CLAIM = 'RelatedPerson.patient';
33
+ /**
34
+ * Legacy telecom alias preserved for older ingestion payloads.
35
+ */
36
+ export const FHIR_RELATED_PERSON_TELECOM_CLAIM = 'RelatedPerson.telecom';
37
+ /**
38
+ * Optional lifecycle/status claim used by projections when present.
39
+ */
40
+ export const FHIR_RELATED_PERSON_STATUS_CLAIM = 'RelatedPerson.status';
41
+ /**
42
+ * Public search parameter names exposed for `RelatedPerson`.
43
+ *
44
+ * These names are independent from the underlying flat claim keys and are the
45
+ * right source for client-side search UIs and future `CapabilityStatement`
46
+ * generation.
47
+ */
48
+ export var RelatedPersonSearchParameterName;
49
+ (function (RelatedPersonSearchParameterName) {
50
+ RelatedPersonSearchParameterName["Identifier"] = "identifier";
51
+ RelatedPersonSearchParameterName["Subject"] = "subject";
52
+ RelatedPersonSearchParameterName["Relationship"] = "relationship";
53
+ RelatedPersonSearchParameterName["Name"] = "name";
54
+ RelatedPersonSearchParameterName["Email"] = "email";
55
+ RelatedPersonSearchParameterName["Phone"] = "phone";
56
+ })(RelatedPersonSearchParameterName || (RelatedPersonSearchParameterName = {}));
57
+ /**
58
+ * Shared searchable/indexable parameter catalog for `RelatedPerson`.
59
+ *
60
+ * `name` is the canonical flat claim key to index/query. The record key is the
61
+ * public search-attribute name.
62
+ */
63
+ export const relatedPersonSearchParameterCatalog = {
64
+ [RelatedPersonSearchParameterName.Identifier]: {
65
+ name: ClaimsContextFhirRelatedPerson.Identifier,
66
+ type: 'token',
67
+ value: undefined,
68
+ indexed: true,
69
+ appliesTo: ['RelatedPerson'],
70
+ },
71
+ [RelatedPersonSearchParameterName.Subject]: {
72
+ name: ClaimsContextFhirRelatedPerson.Subject,
73
+ type: 'reference',
74
+ value: undefined,
75
+ indexed: true,
76
+ claimAliases: [FHIR_RELATED_PERSON_PATIENT_CLAIM],
77
+ appliesTo: ['RelatedPerson'],
78
+ },
79
+ [RelatedPersonSearchParameterName.Relationship]: {
80
+ name: ClaimsContextFhirRelatedPerson.Relationship,
81
+ type: 'token',
82
+ value: undefined,
83
+ indexed: true,
84
+ appliesTo: ['RelatedPerson'],
85
+ },
86
+ [RelatedPersonSearchParameterName.Name]: {
87
+ name: ClaimsContextFhirRelatedPerson.Name,
88
+ type: 'string',
89
+ value: undefined,
90
+ indexed: true,
91
+ appliesTo: ['RelatedPerson'],
92
+ },
93
+ [RelatedPersonSearchParameterName.Email]: {
94
+ name: ClaimsContextFhirRelatedPerson.Email,
95
+ type: 'token',
96
+ value: undefined,
97
+ indexed: true,
98
+ appliesTo: ['RelatedPerson'],
99
+ },
100
+ [RelatedPersonSearchParameterName.Phone]: {
101
+ name: ClaimsContextFhirRelatedPerson.Phone,
102
+ type: 'token',
103
+ value: undefined,
104
+ indexed: true,
105
+ claimAliases: [FHIR_RELATED_PERSON_TELECOM_CLAIM],
106
+ appliesTo: ['RelatedPerson'],
107
+ },
108
+ };
@@ -1,3 +1,9 @@
1
+ /**
2
+ * @fileoverview Barrel export for shared model contracts.
3
+ *
4
+ * @architecture 101
5
+ * Keep this file export-only; shared business logic belongs in dedicated modules.
6
+ */
1
7
  export * from './actor-session';
2
8
  export * from './aes';
3
9
  export * from './auth';
@@ -15,6 +21,7 @@ export * from './crypto';
15
21
  export * from './device-license';
16
22
  export * from './did';
17
23
  export * from './fhir-documents';
24
+ export * from './fhir-related-person';
18
25
  export * from './interoperable-claims';
19
26
  export * from './indexing';
20
27
  export * from './identity-bootstrap';
@@ -34,6 +41,7 @@ export * from './operation-outcome';
34
41
  export * from './params';
35
42
  export * from './resource-document';
36
43
  export * from './relationship-access';
44
+ export * from './related-profile';
37
45
  export * from './response';
38
46
  export * from './urlPath';
39
47
  export * from './verifiable-credential';
@@ -1,3 +1,10 @@
1
+ // Copyright 2026 Antifraud Services Inc. under the Apache License, Version 2.0.
2
+ /**
3
+ * @fileoverview Barrel export for shared model contracts.
4
+ *
5
+ * @architecture 101
6
+ * Keep this file export-only; shared business logic belongs in dedicated modules.
7
+ */
1
8
  export * from './actor-session.js';
2
9
  export * from './aes.js';
3
10
  export * from './auth.js';
@@ -15,6 +22,7 @@ export * from './crypto.js';
15
22
  export * from './device-license.js';
16
23
  export * from './did.js';
17
24
  export * from './fhir-documents.js';
25
+ export * from './fhir-related-person.js';
18
26
  export * from './interoperable-claims.js';
19
27
  export * from './indexing.js';
20
28
  export * from './identity-bootstrap.js';
@@ -34,6 +42,7 @@ export * from './operation-outcome.js';
34
42
  export * from './params.js';
35
43
  export * from './resource-document.js';
36
44
  export * from './relationship-access.js';
45
+ export * from './related-profile.js';
37
46
  export * from './response.js';
38
47
  export * from './urlPath.js';
39
48
  export * from './verifiable-credential.js';
@@ -95,6 +95,31 @@ export interface ParameterData extends ParamAttribute {
95
95
  */
96
96
  appliesTo?: string[];
97
97
  }
98
+ /**
99
+ * Shared definition for a search parameter that can also be used as an
100
+ * indexable attribute contract.
101
+ *
102
+ * `name` remains the canonical flat claim key that will be stored and queried.
103
+ * The record key in a `SearchParameterCatalog` is the public search-attribute
104
+ * name to expose in APIs or capability statements.
105
+ */
106
+ export interface SearchParameterDefinition extends ParameterData {
107
+ /**
108
+ * Optional compatibility aliases accepted on read/normalization before the
109
+ * canonical `name` is used for indexing.
110
+ */
111
+ claimAliases?: readonly string[];
112
+ /**
113
+ * Whether this parameter is intended to be indexed for blind queries.
114
+ * Defaults to `true` when omitted by catalog consumers.
115
+ */
116
+ indexed?: boolean;
117
+ }
118
+ /**
119
+ * Per-resource search parameter catalog keyed by the public search attribute
120
+ * name (e.g. `identifier`, `subject`, `status`).
121
+ */
122
+ export type SearchParameterCatalog<TSearchName extends string = string> = Record<TSearchName, SearchParameterDefinition>;
98
123
  export interface StringSearchParameter extends ParameterData {
99
124
  type: 'string';
100
125
  value: string;
@@ -1,3 +1,2 @@
1
1
  // Copyright 2025 Antifraud Services Inc. under the Apache License, Version 2.0.
2
- // File: crypto-ts/models/params.ts
3
2
  export {};
@@ -0,0 +1,42 @@
1
+ /**
2
+ * @fileoverview Shared DTOs for portal/BFF `related profiles` projections.
3
+ *
4
+ * @architecture 101
5
+ * - These DTOs are frontend-facing projections, not raw FHIR payloads.
6
+ * - Raw search/index semantics stay in `ClaimsContextFhirRelatedPerson`.
7
+ * - Use exported constants for repeated source and parameter names.
8
+ */
9
+ export type RelatedProfileStatus = 'active' | 'pending' | 'inactive' | 'revoked';
10
+ export type RelatedProfileRole = 'controller' | 'caregiver' | 'related-person' | 'professional' | 'member' | 'unknown';
11
+ export type RelatedProfileSource = 'relatedperson';
12
+ export declare const RELATED_PROFILE_SOURCE_RELATED_PERSON: "relatedperson";
13
+ export declare const RELATED_PROFILE_SEARCH_PARAM_ACTOR_IDENTIFIER: "actorIdentifier";
14
+ export declare const RELATED_PROFILE_SEARCH_PARAM_SUBJECT_ID: "subjectId";
15
+ export declare const RELATED_PROFILE_SEARCH_PARAM_RELATIONSHIP: "relationship";
16
+ export declare const RELATED_PROFILE_SEARCH_PARAM_INCLUDE_INACTIVE: "includeInactive";
17
+ export type RelatedProfileSearchInput = Readonly<{
18
+ actorIdentifier: string;
19
+ subjectId?: string;
20
+ relationship?: string;
21
+ includeInactive?: boolean;
22
+ }>;
23
+ export type RelatedProfileSummary = Readonly<{
24
+ relationshipId: string;
25
+ source: RelatedProfileSource;
26
+ subjectId: string;
27
+ actorIdentifier?: string;
28
+ actorDisplayName?: string;
29
+ actorTelecom?: string;
30
+ relationship?: string;
31
+ role: RelatedProfileRole;
32
+ isController: boolean;
33
+ status: RelatedProfileStatus;
34
+ claims: Record<string, unknown>;
35
+ }>;
36
+ export type RelatedProfileSearchResult = Readonly<{
37
+ actorIdentifier: string;
38
+ total: number;
39
+ data: RelatedProfileSummary[];
40
+ }>;
41
+ export declare const DEFAULT_INDIVIDUAL_MEMBER_BASELINE_SEATS = 2;
42
+ export declare const DEFAULT_INDIVIDUAL_MEMBER_BASELINE_PRICE_EUR = "0.00";
@@ -0,0 +1,16 @@
1
+ // Copyright 2026 Antifraud Services Inc. under the Apache License, Version 2.0.
2
+ /**
3
+ * @fileoverview Shared DTOs for portal/BFF `related profiles` projections.
4
+ *
5
+ * @architecture 101
6
+ * - These DTOs are frontend-facing projections, not raw FHIR payloads.
7
+ * - Raw search/index semantics stay in `ClaimsContextFhirRelatedPerson`.
8
+ * - Use exported constants for repeated source and parameter names.
9
+ */
10
+ export const RELATED_PROFILE_SOURCE_RELATED_PERSON = 'relatedperson';
11
+ export const RELATED_PROFILE_SEARCH_PARAM_ACTOR_IDENTIFIER = 'actorIdentifier';
12
+ export const RELATED_PROFILE_SEARCH_PARAM_SUBJECT_ID = 'subjectId';
13
+ export const RELATED_PROFILE_SEARCH_PARAM_RELATIONSHIP = 'relationship';
14
+ export const RELATED_PROFILE_SEARCH_PARAM_INCLUDE_INACTIVE = 'includeInactive';
15
+ export const DEFAULT_INDIVIDUAL_MEMBER_BASELINE_SEATS = 2;
16
+ export const DEFAULT_INDIVIDUAL_MEMBER_BASELINE_PRICE_EUR = '0.00';
@@ -0,0 +1,44 @@
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 {};
@@ -0,0 +1,80 @@
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
+ }
@@ -13,6 +13,7 @@ export * from './didcomm-submit-policy';
13
13
  export * from './discovery-normalization';
14
14
  export * from './format-converter';
15
15
  export * from './fhir-cid';
16
+ export * from './gateway-index-params';
16
17
  export * from './communication-fhir-r4';
17
18
  export * from './communication-document-reference';
18
19
  export * from './communication-identity';
@@ -27,5 +28,6 @@ export * from './normalize';
27
28
  export * from './object-convert';
28
29
  export * from './normalize-uuid';
29
30
  export * from './smart-scope';
31
+ export * from './search-parameter-catalog';
30
32
  export * from './activation-request';
31
33
  export * from './vp-token';
@@ -13,6 +13,7 @@ export * from './didcomm-submit-policy.js';
13
13
  export * from './discovery-normalization.js';
14
14
  export * from './format-converter.js';
15
15
  export * from './fhir-cid.js';
16
+ export * from './gateway-index-params.js';
16
17
  export * from './communication-fhir-r4.js';
17
18
  export * from './communication-document-reference.js';
18
19
  export * from './communication-identity.js';
@@ -27,5 +28,6 @@ export * from './normalize.js';
27
28
  export * from './object-convert.js';
28
29
  export * from './normalize-uuid.js';
29
30
  export * from './smart-scope.js';
31
+ export * from './search-parameter-catalog.js';
30
32
  export * from './activation-request.js';
31
33
  export * from './vp-token.js';
@@ -0,0 +1,31 @@
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[];
@@ -0,0 +1,81 @@
1
+ // Copyright 2026 Antifraud Services Inc. under the Apache License, Version 2.0.
2
+ /**
3
+ * @fileoverview Helpers for shared search-parameter catalogs.
4
+ *
5
+ * @architecture 101
6
+ * - Search catalogs define the public search surface by resource type.
7
+ * - These helpers resolve canonical contextualized claim names plus aliases.
8
+ * - GW managers can use the same catalog both for indexing and for future
9
+ * `CapabilityStatement.searchParam` generation.
10
+ */
11
+ /**
12
+ * Trims a scalar value into a canonical optional string.
13
+ *
14
+ * @param value - Raw claim value.
15
+ * @returns Trimmed text or `undefined` when empty.
16
+ */
17
+ function normalizeOptionalText(value) {
18
+ const normalized = String(value ?? '').trim();
19
+ return normalized || undefined;
20
+ }
21
+ /**
22
+ * Resolves a flat claim using exact match first and `@context`-prefixed lookup
23
+ * as compatibility fallback for contextualized storage mode.
24
+ *
25
+ * @param claims - Flat claims object.
26
+ * @param claimName - Canonical or alias claim key.
27
+ * @returns Scalar value when present.
28
+ */
29
+ function getContextualizedClaimValue(claims, claimName) {
30
+ const directValue = normalizeOptionalText(claims[claimName]);
31
+ if (directValue)
32
+ return directValue;
33
+ const context = normalizeOptionalText(claims['@context']);
34
+ if (!context)
35
+ return undefined;
36
+ const prefixedName = context.endsWith('.') ? `${context}${claimName}` : `${context}.${claimName}`;
37
+ return normalizeOptionalText(claims[prefixedName]);
38
+ }
39
+ /**
40
+ * Resolves the first populated value for a search parameter definition using its
41
+ * canonical claim name followed by any configured aliases.
42
+ *
43
+ * @param claims - Flat claims object.
44
+ * @param definition - Search parameter definition.
45
+ * @returns First populated scalar value, if any.
46
+ */
47
+ export function resolveSearchParameterValueFromClaims(claims, definition) {
48
+ const claimNames = [definition.name, ...(definition.claimAliases || [])];
49
+ for (const claimName of claimNames) {
50
+ const normalized = getContextualizedClaimValue(claims, claimName);
51
+ if (normalized)
52
+ return normalized;
53
+ }
54
+ return undefined;
55
+ }
56
+ /**
57
+ * Builds index/query-ready `ParameterData` entries from a shared search catalog.
58
+ *
59
+ * Only catalog entries marked as indexable, and with a populated value in the
60
+ * claims object, are returned.
61
+ *
62
+ * @param claims - Flat claims object.
63
+ * @param catalog - Shared search parameter catalog for a resource type.
64
+ * @returns Concrete parameter entries with resolved values.
65
+ */
66
+ export function buildIndexParametersFromSearchCatalog(claims, catalog) {
67
+ const parameters = [];
68
+ for (const definition of Object.values(catalog)) {
69
+ if (definition.indexed === false)
70
+ continue;
71
+ const value = resolveSearchParameterValueFromClaims(claims, definition);
72
+ if (!value)
73
+ continue;
74
+ parameters.push({
75
+ ...definition,
76
+ name: definition.name,
77
+ value,
78
+ });
79
+ }
80
+ return parameters;
81
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gdc-common-utils-ts",
3
- "version": "1.8.0",
3
+ "version": "1.9.0",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },