gdc-common-utils-ts 1.7.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.
- package/README.md +3 -1
- package/dist/constants/actor-session.d.ts +40 -0
- package/dist/constants/actor-session.js +40 -0
- package/dist/constants/index.d.ts +1 -0
- package/dist/constants/index.js +1 -0
- package/dist/constants/schemaorg.d.ts +5 -0
- package/dist/constants/schemaorg.js +32 -0
- package/dist/models/actor-session.d.ts +9 -0
- package/dist/models/actor-session.js +3 -0
- package/dist/models/did.d.ts +2 -1
- package/dist/models/fhir-related-person.d.ts +61 -0
- package/dist/models/fhir-related-person.js +108 -0
- package/dist/models/index.d.ts +9 -0
- package/dist/models/index.js +10 -0
- package/dist/models/params.d.ts +25 -0
- package/dist/models/params.js +0 -1
- package/dist/models/related-profile.d.ts +42 -0
- package/dist/models/related-profile.js +16 -0
- package/dist/utils/communication-identity.d.ts +22 -3
- package/dist/utils/communication-identity.js +8 -1
- package/dist/utils/did-resolution.d.ts +2 -1
- package/dist/utils/did-resolution.js +6 -5
- package/dist/utils/gateway-index-params.d.ts +44 -0
- package/dist/utils/gateway-index-params.js +80 -0
- package/dist/utils/index.d.ts +2 -0
- package/dist/utils/index.js +2 -0
- package/dist/utils/search-parameter-catalog.d.ts +31 -0
- package/dist/utils/search-parameter-catalog.js +81 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -131,6 +131,8 @@ The canonical API contract should live in JSDoc on exported code. The README act
|
|
|
131
131
|
### Communication / document utilities
|
|
132
132
|
|
|
133
133
|
- [`initializeCommunicationIdentity(...)`](src/utils/communication-identity.ts)
|
|
134
|
+
- bootstraps the technical communication profile identity for a device/app/channel runtime
|
|
135
|
+
- do not teach its `entityId` as if it were the legal organization id
|
|
134
136
|
- Derives the technical ML-DSA/ML-KEM communication identity for a device, portal, or app profile and returns JOSE header templates for `meta.jws.protected` and `meta.jwe.header`.
|
|
135
137
|
- Uses explicit `seedMaterial` for deterministic derivation. Without `seedMaterial`, it defaults to random generation. `mode = deterministic` requires `seedMaterial`.
|
|
136
138
|
- [`buildOrganizationDidWeb(...)`, `buildProfessionalDidWeb(...)`, `buildIndividualDidWeb(...)`](src/utils/did.ts)
|
|
@@ -208,7 +210,7 @@ The canonical API contract should live in JSDoc on exported code. The README act
|
|
|
208
210
|
- Shared route contexts, controller binding fragments, and reusable helper builders.
|
|
209
211
|
- `tenantId` is modeled as an identifier-like route token (`acme-id`), not as a friendly alternate name.
|
|
210
212
|
- [`docs/LIFECYCLE_101.md`](docs/LIFECYCLE_101.md)
|
|
211
|
-
- Copy/paste lifecycle guide
|
|
213
|
+
- Copy/paste lifecycle `101` guide with semantic rules and reusable placeholders.
|
|
212
214
|
|
|
213
215
|
## Documentation Naming Rules
|
|
214
216
|
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Canonical actor-kind vocabulary shared across SDK packages.
|
|
3
|
+
*/
|
|
4
|
+
export declare const ActorKinds: Readonly<{
|
|
5
|
+
readonly HostOnboarding: "host_onboarding";
|
|
6
|
+
readonly OrganizationController: "organization_controller";
|
|
7
|
+
readonly OrganizationEmployee: "organization_employee";
|
|
8
|
+
readonly IndividualController: "individual_controller";
|
|
9
|
+
readonly IndividualMember: "individual_member";
|
|
10
|
+
readonly Professional: "professional";
|
|
11
|
+
}>;
|
|
12
|
+
/**
|
|
13
|
+
* Canonical capability vocabulary shared across SDK packages.
|
|
14
|
+
*/
|
|
15
|
+
export declare const ActorCapabilities: Readonly<{
|
|
16
|
+
readonly HostActivateOrganization: "host.activate_organization";
|
|
17
|
+
readonly HostConfirmOrder: "host.confirm_order";
|
|
18
|
+
readonly OrganizationCreateEmployee: "organization.create_employee";
|
|
19
|
+
readonly OrganizationDisableEmployee: "organization.disable_employee";
|
|
20
|
+
readonly OrganizationPurgeEmployee: "organization.purge_employee";
|
|
21
|
+
readonly OrganizationActivateDevice: "organization.activate_device";
|
|
22
|
+
readonly OrganizationIssueActivationCode: "organization.issue_activation_code";
|
|
23
|
+
readonly OrganizationRequestSmartToken: "organization.request_smart_token";
|
|
24
|
+
readonly IndividualBootstrap: "individual.bootstrap";
|
|
25
|
+
readonly IndividualDisable: "individual.disable";
|
|
26
|
+
readonly IndividualPurge: "individual.purge";
|
|
27
|
+
readonly IndividualImportIps: "individual.import_ips";
|
|
28
|
+
readonly IndividualGenerateDigitalTwin: "individual.generate_digital_twin";
|
|
29
|
+
readonly IndividualIngestCommunication: "individual.ingest_communication";
|
|
30
|
+
readonly IndividualUpsertRelatedPerson: "individual.upsert_related_person";
|
|
31
|
+
readonly IndividualMemberDisable: "individual_member.disable";
|
|
32
|
+
readonly IndividualMemberPurge: "individual_member.purge";
|
|
33
|
+
readonly ConsentGrantProfessionalAccess: "consent.grant_professional_access";
|
|
34
|
+
readonly ProfessionalMedication: "professional.medication";
|
|
35
|
+
readonly ProfessionalAppointment: "professional.appointment";
|
|
36
|
+
readonly ProfessionalRequestSmartToken: "professional.request_smart_token";
|
|
37
|
+
readonly TokenRequestSmart: "token.request_smart";
|
|
38
|
+
}>;
|
|
39
|
+
export type ActorKindsValue = typeof ActorKinds[keyof typeof ActorKinds];
|
|
40
|
+
export type ActorCapabilitiesValue = typeof ActorCapabilities[keyof typeof ActorCapabilities];
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
// Copyright 2026 Antifraud Services Inc. under the Apache License, Version 2.0.
|
|
2
|
+
// Always create JSDoc, do not use strings inline in keys nor values, use types instead, and reuse the data test examples.
|
|
3
|
+
/**
|
|
4
|
+
* Canonical actor-kind vocabulary shared across SDK packages.
|
|
5
|
+
*/
|
|
6
|
+
export const ActorKinds = Object.freeze({
|
|
7
|
+
HostOnboarding: 'host_onboarding',
|
|
8
|
+
OrganizationController: 'organization_controller',
|
|
9
|
+
OrganizationEmployee: 'organization_employee',
|
|
10
|
+
IndividualController: 'individual_controller',
|
|
11
|
+
IndividualMember: 'individual_member',
|
|
12
|
+
Professional: 'professional',
|
|
13
|
+
});
|
|
14
|
+
/**
|
|
15
|
+
* Canonical capability vocabulary shared across SDK packages.
|
|
16
|
+
*/
|
|
17
|
+
export const ActorCapabilities = Object.freeze({
|
|
18
|
+
HostActivateOrganization: 'host.activate_organization',
|
|
19
|
+
HostConfirmOrder: 'host.confirm_order',
|
|
20
|
+
OrganizationCreateEmployee: 'organization.create_employee',
|
|
21
|
+
OrganizationDisableEmployee: 'organization.disable_employee',
|
|
22
|
+
OrganizationPurgeEmployee: 'organization.purge_employee',
|
|
23
|
+
OrganizationActivateDevice: 'organization.activate_device',
|
|
24
|
+
OrganizationIssueActivationCode: 'organization.issue_activation_code',
|
|
25
|
+
OrganizationRequestSmartToken: 'organization.request_smart_token',
|
|
26
|
+
IndividualBootstrap: 'individual.bootstrap',
|
|
27
|
+
IndividualDisable: 'individual.disable',
|
|
28
|
+
IndividualPurge: 'individual.purge',
|
|
29
|
+
IndividualImportIps: 'individual.import_ips',
|
|
30
|
+
IndividualGenerateDigitalTwin: 'individual.generate_digital_twin',
|
|
31
|
+
IndividualIngestCommunication: 'individual.ingest_communication',
|
|
32
|
+
IndividualUpsertRelatedPerson: 'individual.upsert_related_person',
|
|
33
|
+
IndividualMemberDisable: 'individual_member.disable',
|
|
34
|
+
IndividualMemberPurge: 'individual_member.purge',
|
|
35
|
+
ConsentGrantProfessionalAccess: 'consent.grant_professional_access',
|
|
36
|
+
ProfessionalMedication: 'professional.medication',
|
|
37
|
+
ProfessionalAppointment: 'professional.appointment',
|
|
38
|
+
ProfessionalRequestSmartToken: 'professional.request_smart_token',
|
|
39
|
+
TokenRequestSmart: 'token.request_smart',
|
|
40
|
+
});
|
package/dist/constants/index.js
CHANGED
|
@@ -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,9 @@
|
|
|
1
|
+
import type { ActorCapabilitiesValue, ActorKindsValue } from '../constants/actor-session';
|
|
2
|
+
/**
|
|
3
|
+
* Canonical actor kind shared across SDK packages.
|
|
4
|
+
*/
|
|
5
|
+
export type ActorKind = ActorKindsValue;
|
|
6
|
+
/**
|
|
7
|
+
* Canonical capability token shared across SDK packages.
|
|
8
|
+
*/
|
|
9
|
+
export type Capability = ActorCapabilitiesValue;
|
package/dist/models/did.d.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { PublicJwk } from "../interfaces/Cryptography.types";
|
|
2
2
|
import { RecipientPublicKey } from "./crypto";
|
|
3
3
|
import { JwkSet } from "./jwk";
|
|
4
|
+
import type { ActorKind } from "./actor-session";
|
|
5
|
+
export type { ActorKind } from "./actor-session";
|
|
4
6
|
/**
|
|
5
7
|
* The parameters required to construct a service endpoint selector.
|
|
6
8
|
* This is the contract for a specific API method to define its endpoint.
|
|
@@ -71,7 +73,6 @@ export interface VerificationMethod extends RecipientPublicKey {
|
|
|
71
73
|
controller: string;
|
|
72
74
|
publicKeyJwk: PublicJwk;
|
|
73
75
|
}
|
|
74
|
-
export type ActorKind = 'host_onboarding' | 'organization_controller' | 'organization_employee' | 'individual_controller' | 'individual_member' | 'professional';
|
|
75
76
|
export interface ResolvedServiceEndpoint {
|
|
76
77
|
id: string;
|
|
77
78
|
type: string;
|
|
@@ -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
|
+
};
|
package/dist/models/index.d.ts
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
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
|
+
*/
|
|
7
|
+
export * from './actor-session';
|
|
1
8
|
export * from './aes';
|
|
2
9
|
export * from './auth';
|
|
3
10
|
export * from './bundle';
|
|
@@ -14,6 +21,7 @@ export * from './crypto';
|
|
|
14
21
|
export * from './device-license';
|
|
15
22
|
export * from './did';
|
|
16
23
|
export * from './fhir-documents';
|
|
24
|
+
export * from './fhir-related-person';
|
|
17
25
|
export * from './interoperable-claims';
|
|
18
26
|
export * from './indexing';
|
|
19
27
|
export * from './identity-bootstrap';
|
|
@@ -33,6 +41,7 @@ export * from './operation-outcome';
|
|
|
33
41
|
export * from './params';
|
|
34
42
|
export * from './resource-document';
|
|
35
43
|
export * from './relationship-access';
|
|
44
|
+
export * from './related-profile';
|
|
36
45
|
export * from './response';
|
|
37
46
|
export * from './urlPath';
|
|
38
47
|
export * from './verifiable-credential';
|
package/dist/models/index.js
CHANGED
|
@@ -1,3 +1,11 @@
|
|
|
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
|
+
*/
|
|
8
|
+
export * from './actor-session.js';
|
|
1
9
|
export * from './aes.js';
|
|
2
10
|
export * from './auth.js';
|
|
3
11
|
export * from './bundle.js';
|
|
@@ -14,6 +22,7 @@ export * from './crypto.js';
|
|
|
14
22
|
export * from './device-license.js';
|
|
15
23
|
export * from './did.js';
|
|
16
24
|
export * from './fhir-documents.js';
|
|
25
|
+
export * from './fhir-related-person.js';
|
|
17
26
|
export * from './interoperable-claims.js';
|
|
18
27
|
export * from './indexing.js';
|
|
19
28
|
export * from './identity-bootstrap.js';
|
|
@@ -33,6 +42,7 @@ export * from './operation-outcome.js';
|
|
|
33
42
|
export * from './params.js';
|
|
34
43
|
export * from './resource-document.js';
|
|
35
44
|
export * from './relationship-access.js';
|
|
45
|
+
export * from './related-profile.js';
|
|
36
46
|
export * from './response.js';
|
|
37
47
|
export * from './urlPath.js';
|
|
38
48
|
export * from './verifiable-credential.js';
|
package/dist/models/params.d.ts
CHANGED
|
@@ -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;
|
package/dist/models/params.js
CHANGED
|
@@ -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';
|
|
@@ -6,9 +6,21 @@ import { JwkKeyUses } from '../constants/cryptography';
|
|
|
6
6
|
export type CommunicationIdentityBootstrapMode = 'deterministic' | 'random';
|
|
7
7
|
export interface CommunicationIdentityBootstrapOptions {
|
|
8
8
|
/**
|
|
9
|
-
* Stable logical identifier of the
|
|
9
|
+
* Stable logical identifier of the technical communication profile.
|
|
10
10
|
*
|
|
11
|
-
* This is
|
|
11
|
+
* This is not the legal organization id, not the tenant id, and not the
|
|
12
|
+
* human controller identity.
|
|
13
|
+
*
|
|
14
|
+
* Treat it as the id of the technical channel/runtime/device profile that
|
|
15
|
+
* owns the communication keys for this app/service.
|
|
16
|
+
*
|
|
17
|
+
* Good examples:
|
|
18
|
+
* - `portal.acme.org:acme-id:web-channel`
|
|
19
|
+
* - `portal.acme.org:acme-id:backend-runtime`
|
|
20
|
+
* - `mobile.acme.app:user-42:device-primary`
|
|
21
|
+
*
|
|
22
|
+
* This value is metadata for the caller. It is not used as implicit seed
|
|
23
|
+
* material.
|
|
12
24
|
*/
|
|
13
25
|
entityId: string;
|
|
14
26
|
/**
|
|
@@ -114,10 +126,17 @@ export interface CommunicationIdentityBootstrapResult {
|
|
|
114
126
|
* human/person signing identity used for controller/professional/individual
|
|
115
127
|
* authorization decisions.
|
|
116
128
|
*
|
|
129
|
+
* Conceptual split:
|
|
130
|
+
* - `appId` identifies the application towards GW CORE headers/policy
|
|
131
|
+
* - `entityId` identifies the local technical communication profile that owns
|
|
132
|
+
* transport keys
|
|
133
|
+
* - controller/professional/subject DIDs identify domain actors
|
|
134
|
+
*
|
|
117
135
|
* The returned JOSE header templates match the current DIDComm metadata contract:
|
|
118
136
|
* `meta.jws.protected` and `meta.jwe.header`.
|
|
119
137
|
*
|
|
120
|
-
* @param options.entityId Stable logical identity of the
|
|
138
|
+
* @param options.entityId Stable logical identity of the technical
|
|
139
|
+
* communication profile or channel runtime.
|
|
121
140
|
* @param options.seedMaterial Explicit seed material for deterministic derivation.
|
|
122
141
|
* @param options.cryptography Stateless crypto engine implementation.
|
|
123
142
|
* @param options.mode Deterministic or random seed derivation mode.
|
|
@@ -11,10 +11,17 @@ import { CommunicationKeyPurposes, DefaultEncryptionCurves, DefaultSigningAlgori
|
|
|
11
11
|
* human/person signing identity used for controller/professional/individual
|
|
12
12
|
* authorization decisions.
|
|
13
13
|
*
|
|
14
|
+
* Conceptual split:
|
|
15
|
+
* - `appId` identifies the application towards GW CORE headers/policy
|
|
16
|
+
* - `entityId` identifies the local technical communication profile that owns
|
|
17
|
+
* transport keys
|
|
18
|
+
* - controller/professional/subject DIDs identify domain actors
|
|
19
|
+
*
|
|
14
20
|
* The returned JOSE header templates match the current DIDComm metadata contract:
|
|
15
21
|
* `meta.jws.protected` and `meta.jwe.header`.
|
|
16
22
|
*
|
|
17
|
-
* @param options.entityId Stable logical identity of the
|
|
23
|
+
* @param options.entityId Stable logical identity of the technical
|
|
24
|
+
* communication profile or channel runtime.
|
|
18
25
|
* @param options.seedMaterial Explicit seed material for deterministic derivation.
|
|
19
26
|
* @param options.cryptography Stateless crypto engine implementation.
|
|
20
27
|
* @param options.mode Deterministic or random seed derivation mode.
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { ActorKind
|
|
1
|
+
import type { ActorKind } from '../models/actor-session';
|
|
2
|
+
import { DidDocument, DidResolutionResult, ResolvedServiceEndpoint } from '../models/did';
|
|
2
3
|
/**
|
|
3
4
|
* Service selection criteria used when resolving operational endpoints from a DID Document.
|
|
4
5
|
*/
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
// Copyright 2026 Antifraud Services Inc. under the Apache License, Version 2.0.
|
|
2
|
+
import { ActorKinds } from '../constants/actor-session.js';
|
|
2
3
|
import { DiscoveryCapabilities, DidServiceIds } from '../constants/did-services.js';
|
|
3
4
|
function normalizeServiceEndpoint(service) {
|
|
4
5
|
const capability = inferCapabilityFromServiceId(service.id)
|
|
@@ -147,16 +148,16 @@ export function getActorKindFromDid(did) {
|
|
|
147
148
|
return 'unknown';
|
|
148
149
|
if (normalized.includes(':employee:')) {
|
|
149
150
|
return normalized.includes('resprsn') || normalized.includes('controller')
|
|
150
|
-
?
|
|
151
|
-
:
|
|
151
|
+
? ActorKinds.OrganizationController
|
|
152
|
+
: ActorKinds.Professional;
|
|
152
153
|
}
|
|
153
154
|
if (normalized.includes(':family:') || normalized.includes(':member:')) {
|
|
154
155
|
return normalized.includes('oneself') || normalized.includes('controller')
|
|
155
|
-
?
|
|
156
|
-
:
|
|
156
|
+
? ActorKinds.IndividualController
|
|
157
|
+
: ActorKinds.IndividualMember;
|
|
157
158
|
}
|
|
158
159
|
if (normalized.includes('host'))
|
|
159
|
-
return
|
|
160
|
+
return ActorKinds.HostOnboarding;
|
|
160
161
|
return 'unknown';
|
|
161
162
|
}
|
|
162
163
|
/**
|
|
@@ -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
|
+
}
|
package/dist/utils/index.d.ts
CHANGED
|
@@ -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';
|
package/dist/utils/index.js
CHANGED
|
@@ -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
|
+
}
|