gdc-common-utils-ts 1.5.0 → 1.6.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 +36 -4
- package/dist/constants/schemaorg.d.ts +2 -0
- package/dist/constants/schemaorg.js +2 -0
- package/dist/examples/api-flow-examples.d.ts +1 -0
- package/dist/examples/api-flow-examples.js +1 -0
- package/dist/examples/consent-access.d.ts +146 -0
- package/dist/examples/consent-access.js +112 -0
- package/dist/examples/contract-examples.d.ts +1 -0
- package/dist/examples/contract-examples.js +1 -0
- package/dist/examples/index.d.ts +3 -0
- package/dist/examples/index.js +3 -0
- package/dist/examples/individual-controller.d.ts +0 -15
- package/dist/examples/individual-controller.js +2 -1
- package/dist/examples/lifecycle.d.ts +503 -0
- package/dist/examples/lifecycle.js +289 -0
- package/dist/examples/organization-controller.d.ts +2 -2
- package/dist/examples/organization-controller.js +3 -3
- package/dist/examples/professional.d.ts +9 -2
- package/dist/examples/professional.js +16 -5
- package/dist/examples/relationship-access.d.ts +11 -0
- package/dist/examples/relationship-access.js +96 -0
- package/dist/examples/shared.d.ts +34 -0
- package/dist/examples/shared.js +30 -24
- package/dist/models/consent-access.d.ts +79 -0
- package/dist/models/consent-access.js +2 -0
- package/dist/models/index.d.ts +2 -0
- package/dist/models/index.js +2 -0
- package/dist/models/relationship-access.d.ts +160 -0
- package/dist/models/relationship-access.js +21 -0
- package/dist/utils/activation-request.d.ts +42 -0
- package/dist/utils/activation-request.js +42 -0
- package/dist/utils/communication-identity.d.ts +25 -15
- package/dist/utils/communication-identity.js +23 -13
- package/dist/utils/consent.d.ts +74 -0
- package/dist/utils/consent.js +485 -0
- package/dist/utils/index.d.ts +1 -0
- package/dist/utils/index.js +1 -0
- package/dist/utils/individual-form-pdf.d.ts +55 -0
- package/dist/utils/individual-form-pdf.js +191 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -117,6 +117,7 @@ The canonical API contract should live in JSDoc on exported code. The README act
|
|
|
117
117
|
- Shared network/environment labels for node-operator discovery/bootstrap.
|
|
118
118
|
- [`SmartGatewayScopesFhirR4`](src/constants/smart.ts)
|
|
119
119
|
- Current CORE GW SMART scope literals such as `organization/Consent.cruds`.
|
|
120
|
+
- Treat these as optional elevated scopes. Do not add them to the first read-only tutorial by default.
|
|
120
121
|
|
|
121
122
|
### Root exports
|
|
122
123
|
|
|
@@ -129,13 +130,14 @@ The canonical API contract should live in JSDoc on exported code. The README act
|
|
|
129
130
|
|
|
130
131
|
### Communication / document utilities
|
|
131
132
|
|
|
132
|
-
- [`
|
|
133
|
+
- [`initializeCommunicationIdentity(...)`](src/utils/communication-identity.ts)
|
|
133
134
|
- 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`.
|
|
134
|
-
-
|
|
135
|
+
- Uses explicit `seedMaterial` for deterministic derivation. Without `seedMaterial`, it defaults to random generation. `mode = deterministic` requires `seedMaterial`.
|
|
135
136
|
- [`buildOrganizationDidWeb(...)`, `buildProfessionalDidWeb(...)`, `buildIndividualDidWeb(...)`](src/utils/did.ts)
|
|
136
137
|
- Build canonical data-space `did:web` identifiers for hosted organizations, professionals, and individuals/family actors.
|
|
137
138
|
- [`buildSmartCompositionReadScope(...)`](src/utils/smart-scope.ts)
|
|
138
139
|
- Builds the current CORE GW pinned SMART root scope for `organization/Composition...` token requests.
|
|
140
|
+
- This is the preferred first scope to teach when the backend only needs subject-scoped read access.
|
|
139
141
|
- [`getOrganizationCredentialFromVpToken(...)`, `getLegalRepresentativeCredentialFromVpToken(...)`](src/utils/vp-token.ts)
|
|
140
142
|
- Extract typed VC objects from a VP token when GW/SDK flows carry canonical proof only in `vp_token`.
|
|
141
143
|
- [`validateCommunicationResourceFhirR4(...)`](src/utils/communication-fhir-r4.ts)
|
|
@@ -156,6 +158,14 @@ The canonical API contract should live in JSDoc on exported code. The README act
|
|
|
156
158
|
- [`ControllerBindingInput`, `OrganizationBindingInput`, `ActivationProofInput`, `OrganizationActivationRequest`](src/models/identity-bootstrap.ts)
|
|
157
159
|
- Canonical bootstrap contracts that explicitly separate person/controller key binding from provider/organization key binding.
|
|
158
160
|
- `vp_token` is the canonical proof carrier; `controller.*` and `organization.*` carry public key binding material for DID publication.
|
|
161
|
+
- [`buildControllerBindingInput(...)`, `buildOrganizationBindingInput(...)`](src/utils/activation-request.ts)
|
|
162
|
+
- Build canonical `controller.*` and `organization.*` binding fragments from semantic variables such as `publicSignKey`, `publicKeys`, `did`, `sameAs`, or `url`.
|
|
163
|
+
- [`RelationshipChannelInvitationInput`, `RelationshipChannelInvitationSummary`, `RelationshipChannelOtpStartInput`, `RelationshipChannelOtpConfirmInput`](src/models/relationship-access.ts)
|
|
164
|
+
- Shared contracts for controller-driven invitation and acceptance flows between an individual/subject and a related person or professional across phone, email, and app channels.
|
|
165
|
+
- [`RelationshipEnrollmentChannels`, `RelationshipSubjectKinds`, `RelationshipAccessActorKinds`, `RelationshipOtpDeliveryChannels`](src/models/relationship-access.ts)
|
|
166
|
+
- Shared constant objects for relationship flows so docs and app code do not hardcode actor kinds or channel labels inline.
|
|
167
|
+
- [`RelationshipChannelOtpChallengeSummary`, `RelationshipPinPolicy`, `RelationshipPinSetInput`, `RelationshipPinVerifyInput`, `RelationshipLocalKeyEnvelope`](src/models/relationship-access.ts)
|
|
168
|
+
- Shared OTP, relationship PIN, and offline-first local-key envelope contracts for channel enrollment and subject-scoped local protection.
|
|
159
169
|
- [`IdentityBootstrapValidationIssue`, `IdentityBootstrapValidationResult`](src/models/identity-bootstrap.ts)
|
|
160
170
|
- Shared validation result shapes used by bootstrap builders/validators.
|
|
161
171
|
- [`buildOrganizationActivationRequest(...)`](src/utils/activation-request.ts)
|
|
@@ -186,13 +196,35 @@ The canonical API contract should live in JSDoc on exported code. The README act
|
|
|
186
196
|
- CORE canonical examples are email-first and do not require phone-only fields unless an extension layer adds them.
|
|
187
197
|
- [`src/examples/professional.ts`](src/examples/professional.ts)
|
|
188
198
|
- Professional/physician runtime access examples such as SMART token and clinical access request payloads.
|
|
199
|
+
- The base token examples are read-only; richer scenario fixtures intentionally add `organization/Consent.cruds`.
|
|
189
200
|
- [`src/examples/related-person.ts`](src/examples/related-person.ts)
|
|
190
201
|
- RelatedPerson/family-member examples.
|
|
191
202
|
- [`src/examples/frontend-session.ts`](src/examples/frontend-session.ts)
|
|
192
203
|
- Frontend profile/session bootstrap examples.
|
|
204
|
+
- [`src/examples/lifecycle.ts`](src/examples/lifecycle.ts)
|
|
205
|
+
- Canonical `enable/disable/delete` lifecycle examples with placeholders and no personal data.
|
|
206
|
+
- This is the source of truth for GW, Swagger, Node SDK, Front SDK, and portal examples.
|
|
193
207
|
- [`src/examples/shared.ts`](src/examples/shared.ts)
|
|
194
208
|
- Shared route contexts, controller binding fragments, and reusable helper builders.
|
|
195
209
|
- `tenantId` is modeled as an identifier-like route token (`acme-id`), not as a friendly alternate name.
|
|
210
|
+
- [`docs/LIFECYCLE_101.md`](docs/LIFECYCLE_101.md)
|
|
211
|
+
- Copy/paste lifecycle guide "for torpes" with semantic rules and reusable placeholders.
|
|
212
|
+
|
|
213
|
+
## Documentation Naming Rules
|
|
214
|
+
|
|
215
|
+
Prefer these semantic names in docs and examples:
|
|
216
|
+
|
|
217
|
+
- `subjectDid`
|
|
218
|
+
- `professionalDid`
|
|
219
|
+
- `orgControllerDid`
|
|
220
|
+
- `individualControllerDid`
|
|
221
|
+
- `emailProfessional`
|
|
222
|
+
- `emailControllerOrg`
|
|
223
|
+
- `emailControllerIndividual`
|
|
224
|
+
- `emailRelatedPerson`
|
|
225
|
+
|
|
226
|
+
Avoid teaching new integrations from legacy names such as `individualDidWeb`
|
|
227
|
+
when the active runtime variable is really the subject identifier.
|
|
196
228
|
- [`src/examples/api-flow-examples.ts`](src/examples/api-flow-examples.ts)
|
|
197
229
|
- Preferred compatibility aggregator for consumers that want one import surface without using the overloaded term `contract`.
|
|
198
230
|
- [`src/examples/contract-examples.ts`](src/examples/contract-examples.ts)
|
|
@@ -347,7 +379,7 @@ Those request/response flows belong in connector SDKs and backend orchestration
|
|
|
347
379
|
|
|
348
380
|
When integrating the converged SDKs:
|
|
349
381
|
|
|
350
|
-
- use [`
|
|
382
|
+
- use [`initializeCommunicationIdentity(...)`](src/utils/communication-identity.ts) from this package for the technical communication identity bootstrap
|
|
351
383
|
- use `gdc-sdk-core-ts` for runtime-neutral communication/document helpers
|
|
352
384
|
- use `gdc-sdk-front-ts` or `gdc-sdk-node-ts` for the runtime-specific session and orchestration layer
|
|
353
385
|
|
|
@@ -360,5 +392,5 @@ When integrating the converged SDKs:
|
|
|
360
392
|
- The `files` field only publishes `dist/`, so source imports should use the documented package entry points rather than local file paths.
|
|
361
393
|
|
|
362
394
|
## Roadmap and Briefing
|
|
363
|
-
- `BRIEFING_DATASPACE_EN.md`
|
|
395
|
+
- `docs/BRIEFING_DATASPACE_EN.md`
|
|
364
396
|
- `TODO_ROADMAP.md`
|
|
@@ -43,6 +43,8 @@ export declare enum ClaimsOrganizationSchemaorg {
|
|
|
43
43
|
ownerEmail = "org.schema.Organization.owner.email",
|
|
44
44
|
/** Individual/family owner telephone used by subject-index registration flows. */
|
|
45
45
|
ownerTelephone = "org.schema.Organization.owner.telephone",
|
|
46
|
+
/** Individual/family owner legal identifier used by subject-index registration flows. */
|
|
47
|
+
ownerIdentifierValue = "org.schema.Organization.owner.identifier.value",
|
|
46
48
|
numberOfEmployees = "org.schema.Organization.numberOfEmployees.value"
|
|
47
49
|
}
|
|
48
50
|
export declare enum ClaimsOfferSchemaorg {
|
|
@@ -46,6 +46,8 @@ export var ClaimsOrganizationSchemaorg;
|
|
|
46
46
|
ClaimsOrganizationSchemaorg["ownerEmail"] = "org.schema.Organization.owner.email";
|
|
47
47
|
/** Individual/family owner telephone used by subject-index registration flows. */
|
|
48
48
|
ClaimsOrganizationSchemaorg["ownerTelephone"] = "org.schema.Organization.owner.telephone";
|
|
49
|
+
/** Individual/family owner legal identifier used by subject-index registration flows. */
|
|
50
|
+
ClaimsOrganizationSchemaorg["ownerIdentifierValue"] = "org.schema.Organization.owner.identifier.value";
|
|
49
51
|
ClaimsOrganizationSchemaorg["numberOfEmployees"] = "org.schema.Organization.numberOfEmployees.value"; // to purchase licenses for device profile's activation
|
|
50
52
|
})(ClaimsOrganizationSchemaorg || (ClaimsOrganizationSchemaorg = {}));
|
|
51
53
|
export var ClaimsOfferSchemaorg;
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
export declare const EXAMPLE_INDIVIDUAL_DID_WEB: "did:web:api.acme.org:individual:123";
|
|
2
|
+
export declare const EXAMPLE_PROVIDER_ORGANIZATION_DID_WEB: "did:web:hospital.acme.org";
|
|
3
|
+
export declare const EXAMPLE_EMAIL_PROFESSIONAL: "doctor.oncall@example.org";
|
|
4
|
+
export declare const EXAMPLE_EMAIL_RELATED_PERSON: "parent.guardian@example.org";
|
|
5
|
+
export declare const EXAMPLE_CONSENT_ACCESS_JURISDICTION: "ES";
|
|
6
|
+
/**
|
|
7
|
+
* Legacy compatibility aliases kept so older docs/tests/imports continue to work
|
|
8
|
+
* while the canonical variable names converge.
|
|
9
|
+
*/
|
|
10
|
+
export declare const EXAMPLE_CONSENT_ACCESS_SUBJECT: "did:web:api.acme.org:individual:123";
|
|
11
|
+
export declare const EXAMPLE_CONSENT_ACCESS_PROVIDER_DID: "did:web:hospital.acme.org";
|
|
12
|
+
export declare const EXAMPLE_CONSENT_ACCESS_PROVIDER_EMAIL: "doctor.oncall@example.org";
|
|
13
|
+
export declare const EXAMPLE_CONSENT_ACCESS_RELATED_PERSON_EMAIL: "parent.guardian@example.org";
|
|
14
|
+
export declare const EXAMPLE_CONSENT_ACCESS_RULES: Readonly<{
|
|
15
|
+
physicianByEmailContinuousCare: {
|
|
16
|
+
readonly 'Consent.date': "2026-05-20";
|
|
17
|
+
readonly 'Consent.period-end'?: string | undefined;
|
|
18
|
+
readonly 'Consent.period-start'?: string | undefined;
|
|
19
|
+
readonly 'Consent.resourceType'?: string | undefined;
|
|
20
|
+
readonly '@context': "org.hl7.fhir.api";
|
|
21
|
+
readonly 'Consent.identifier': string;
|
|
22
|
+
readonly 'Consent.subject': "did:web:api.acme.org:individual:123";
|
|
23
|
+
readonly 'Consent.actor-identifier': string;
|
|
24
|
+
readonly 'Consent.actor-role': string;
|
|
25
|
+
readonly 'Consent.decision': "permit" | "deny";
|
|
26
|
+
readonly 'Consent.purpose': string;
|
|
27
|
+
readonly 'Consent.action': string;
|
|
28
|
+
};
|
|
29
|
+
physicianByEmailEmergency: {
|
|
30
|
+
readonly 'Consent.date': "2026-05-20";
|
|
31
|
+
readonly 'Consent.period-end'?: string | undefined;
|
|
32
|
+
readonly 'Consent.period-start'?: string | undefined;
|
|
33
|
+
readonly 'Consent.resourceType'?: string | undefined;
|
|
34
|
+
readonly '@context': "org.hl7.fhir.api";
|
|
35
|
+
readonly 'Consent.identifier': string;
|
|
36
|
+
readonly 'Consent.subject': "did:web:api.acme.org:individual:123";
|
|
37
|
+
readonly 'Consent.actor-identifier': string;
|
|
38
|
+
readonly 'Consent.actor-role': string;
|
|
39
|
+
readonly 'Consent.decision': "permit" | "deny";
|
|
40
|
+
readonly 'Consent.purpose': string;
|
|
41
|
+
readonly 'Consent.action': string;
|
|
42
|
+
};
|
|
43
|
+
physicianByOrganizationContinuousCare: {
|
|
44
|
+
readonly 'Consent.date': "2026-05-20";
|
|
45
|
+
readonly 'Consent.period-end'?: string | undefined;
|
|
46
|
+
readonly 'Consent.period-start'?: string | undefined;
|
|
47
|
+
readonly 'Consent.resourceType'?: string | undefined;
|
|
48
|
+
readonly '@context': "org.hl7.fhir.api";
|
|
49
|
+
readonly 'Consent.identifier': string;
|
|
50
|
+
readonly 'Consent.subject': "did:web:api.acme.org:individual:123";
|
|
51
|
+
readonly 'Consent.actor-identifier': string;
|
|
52
|
+
readonly 'Consent.actor-role': string;
|
|
53
|
+
readonly 'Consent.decision': "permit" | "deny";
|
|
54
|
+
readonly 'Consent.purpose': string;
|
|
55
|
+
readonly 'Consent.action': string;
|
|
56
|
+
};
|
|
57
|
+
physicianByJurisdictionEmergency: {
|
|
58
|
+
readonly 'Consent.date': "2026-05-20";
|
|
59
|
+
readonly 'Consent.period-end'?: string | undefined;
|
|
60
|
+
readonly 'Consent.period-start'?: string | undefined;
|
|
61
|
+
readonly 'Consent.resourceType'?: string | undefined;
|
|
62
|
+
readonly '@context': "org.hl7.fhir.api";
|
|
63
|
+
readonly 'Consent.identifier': string;
|
|
64
|
+
readonly 'Consent.subject': "did:web:api.acme.org:individual:123";
|
|
65
|
+
readonly 'Consent.actor-identifier': string;
|
|
66
|
+
readonly 'Consent.actor-role': string;
|
|
67
|
+
readonly 'Consent.decision': "permit" | "deny";
|
|
68
|
+
readonly 'Consent.purpose': string;
|
|
69
|
+
readonly 'Consent.action': string;
|
|
70
|
+
};
|
|
71
|
+
nurseByOrganization: {
|
|
72
|
+
readonly 'Consent.date': "2026-05-20";
|
|
73
|
+
readonly 'Consent.period-end'?: string | undefined;
|
|
74
|
+
readonly 'Consent.period-start'?: string | undefined;
|
|
75
|
+
readonly 'Consent.resourceType'?: string | undefined;
|
|
76
|
+
readonly '@context': "org.hl7.fhir.api";
|
|
77
|
+
readonly 'Consent.identifier': string;
|
|
78
|
+
readonly 'Consent.subject': "did:web:api.acme.org:individual:123";
|
|
79
|
+
readonly 'Consent.actor-identifier': string;
|
|
80
|
+
readonly 'Consent.actor-role': string;
|
|
81
|
+
readonly 'Consent.decision': "permit" | "deny";
|
|
82
|
+
readonly 'Consent.purpose': string;
|
|
83
|
+
readonly 'Consent.action': string;
|
|
84
|
+
};
|
|
85
|
+
paramedicByJurisdiction: {
|
|
86
|
+
readonly 'Consent.date': "2026-05-20";
|
|
87
|
+
readonly 'Consent.period-end'?: string | undefined;
|
|
88
|
+
readonly 'Consent.period-start'?: string | undefined;
|
|
89
|
+
readonly 'Consent.resourceType'?: string | undefined;
|
|
90
|
+
readonly '@context': "org.hl7.fhir.api";
|
|
91
|
+
readonly 'Consent.identifier': string;
|
|
92
|
+
readonly 'Consent.subject': "did:web:api.acme.org:individual:123";
|
|
93
|
+
readonly 'Consent.actor-identifier': string;
|
|
94
|
+
readonly 'Consent.actor-role': string;
|
|
95
|
+
readonly 'Consent.decision': "permit" | "deny";
|
|
96
|
+
readonly 'Consent.purpose': string;
|
|
97
|
+
readonly 'Consent.action': string;
|
|
98
|
+
};
|
|
99
|
+
directPhysicianDenyInsideAllowedOrganization: {
|
|
100
|
+
readonly 'Consent.date': "2026-05-20";
|
|
101
|
+
readonly 'Consent.period-end'?: string | undefined;
|
|
102
|
+
readonly 'Consent.period-start'?: string | undefined;
|
|
103
|
+
readonly 'Consent.resourceType'?: string | undefined;
|
|
104
|
+
readonly '@context': "org.hl7.fhir.api";
|
|
105
|
+
readonly 'Consent.identifier': string;
|
|
106
|
+
readonly 'Consent.subject': "did:web:api.acme.org:individual:123";
|
|
107
|
+
readonly 'Consent.actor-identifier': string;
|
|
108
|
+
readonly 'Consent.actor-role': string;
|
|
109
|
+
readonly 'Consent.decision': "permit" | "deny";
|
|
110
|
+
readonly 'Consent.purpose': string;
|
|
111
|
+
readonly 'Consent.action': string;
|
|
112
|
+
};
|
|
113
|
+
relatedPersonByEmail: {
|
|
114
|
+
readonly 'Consent.date': "2026-05-20";
|
|
115
|
+
readonly 'Consent.period-end'?: string | undefined;
|
|
116
|
+
readonly 'Consent.period-start'?: string | undefined;
|
|
117
|
+
readonly 'Consent.resourceType'?: string | undefined;
|
|
118
|
+
readonly '@context': "org.hl7.fhir.api";
|
|
119
|
+
readonly 'Consent.identifier': string;
|
|
120
|
+
readonly 'Consent.subject': "did:web:api.acme.org:individual:123";
|
|
121
|
+
readonly 'Consent.actor-identifier': string;
|
|
122
|
+
readonly 'Consent.actor-role': string;
|
|
123
|
+
readonly 'Consent.decision': "permit" | "deny";
|
|
124
|
+
readonly 'Consent.purpose': string;
|
|
125
|
+
readonly 'Consent.action': string;
|
|
126
|
+
};
|
|
127
|
+
revokedPhysicianEmailConsent: {
|
|
128
|
+
readonly 'Consent.date': "2026-05-20";
|
|
129
|
+
readonly 'Consent.period-end'?: string | undefined;
|
|
130
|
+
readonly 'Consent.period-start'?: string | undefined;
|
|
131
|
+
readonly 'Consent.resourceType'?: string | undefined;
|
|
132
|
+
readonly '@context': "org.hl7.fhir.api";
|
|
133
|
+
readonly 'Consent.identifier': string;
|
|
134
|
+
readonly 'Consent.subject': "did:web:api.acme.org:individual:123";
|
|
135
|
+
readonly 'Consent.actor-identifier': string;
|
|
136
|
+
readonly 'Consent.actor-role': string;
|
|
137
|
+
readonly 'Consent.decision': "permit" | "deny";
|
|
138
|
+
readonly 'Consent.purpose': string;
|
|
139
|
+
readonly 'Consent.action': string;
|
|
140
|
+
};
|
|
141
|
+
}>;
|
|
142
|
+
export declare const EXAMPLE_CONSENT_PHONE_EXTENSION_PENDING: Readonly<{
|
|
143
|
+
target: "tel:+34600111222";
|
|
144
|
+
status: "pending-extension";
|
|
145
|
+
reason: "telephone actor targeting remains an extension concern unless the sector/runtime explicitly enables it";
|
|
146
|
+
}>;
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
// Copyright 2026 Antifraud Services Inc. under the Apache License, Version 2.0.
|
|
2
|
+
import { HealthcareActorRoles, HealthcareBasicSections, HealthcareConsentPurposes, } from '../constants/healthcare.js';
|
|
3
|
+
import { ResourceTypesFhirR4 } from '../constants/fhir-resource-types.js';
|
|
4
|
+
export const EXAMPLE_INDIVIDUAL_DID_WEB = 'did:web:api.acme.org:individual:123';
|
|
5
|
+
export const EXAMPLE_PROVIDER_ORGANIZATION_DID_WEB = 'did:web:hospital.acme.org';
|
|
6
|
+
export const EXAMPLE_EMAIL_PROFESSIONAL = 'doctor.oncall@example.org';
|
|
7
|
+
export const EXAMPLE_EMAIL_RELATED_PERSON = 'parent.guardian@example.org';
|
|
8
|
+
export const EXAMPLE_CONSENT_ACCESS_JURISDICTION = 'ES';
|
|
9
|
+
/**
|
|
10
|
+
* Legacy compatibility aliases kept so older docs/tests/imports continue to work
|
|
11
|
+
* while the canonical variable names converge.
|
|
12
|
+
*/
|
|
13
|
+
export const EXAMPLE_CONSENT_ACCESS_SUBJECT = EXAMPLE_INDIVIDUAL_DID_WEB;
|
|
14
|
+
export const EXAMPLE_CONSENT_ACCESS_PROVIDER_DID = EXAMPLE_PROVIDER_ORGANIZATION_DID_WEB;
|
|
15
|
+
export const EXAMPLE_CONSENT_ACCESS_PROVIDER_EMAIL = EXAMPLE_EMAIL_PROFESSIONAL;
|
|
16
|
+
export const EXAMPLE_CONSENT_ACCESS_RELATED_PERSON_EMAIL = EXAMPLE_EMAIL_RELATED_PERSON;
|
|
17
|
+
function buildRule(input) {
|
|
18
|
+
return {
|
|
19
|
+
'@context': 'org.hl7.fhir.api',
|
|
20
|
+
'Consent.identifier': input.identifier,
|
|
21
|
+
'Consent.subject': EXAMPLE_INDIVIDUAL_DID_WEB,
|
|
22
|
+
'Consent.actor-identifier': input.actorIdentifier,
|
|
23
|
+
'Consent.actor-role': input.actorRole,
|
|
24
|
+
'Consent.decision': input.decision || 'permit',
|
|
25
|
+
'Consent.purpose': input.purpose,
|
|
26
|
+
'Consent.action': input.actions.join(','),
|
|
27
|
+
...(input.resourceTypes?.length ? { 'Consent.resourceType': input.resourceTypes.join(',') } : {}),
|
|
28
|
+
...(input.periodStart ? { 'Consent.period-start': input.periodStart } : {}),
|
|
29
|
+
...(input.periodEnd ? { 'Consent.period-end': input.periodEnd } : {}),
|
|
30
|
+
'Consent.date': '2026-05-20',
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
export const EXAMPLE_CONSENT_ACCESS_RULES = Object.freeze({
|
|
34
|
+
physicianByEmailContinuousCare: buildRule({
|
|
35
|
+
identifier: 'urn:uuid:consent-physician-email-treatment',
|
|
36
|
+
actorIdentifier: EXAMPLE_EMAIL_PROFESSIONAL,
|
|
37
|
+
actorRole: HealthcareActorRoles.Physician,
|
|
38
|
+
purpose: HealthcareConsentPurposes.Treatment,
|
|
39
|
+
actions: [HealthcareBasicSections.AllergiesAndIntolerances.claim],
|
|
40
|
+
resourceTypes: [ResourceTypesFhirR4.Composition, ResourceTypesFhirR4.AllergyIntolerance],
|
|
41
|
+
}),
|
|
42
|
+
physicianByEmailEmergency: buildRule({
|
|
43
|
+
identifier: 'urn:uuid:consent-physician-email-emergency',
|
|
44
|
+
actorIdentifier: EXAMPLE_EMAIL_PROFESSIONAL,
|
|
45
|
+
actorRole: HealthcareActorRoles.Physician,
|
|
46
|
+
purpose: HealthcareConsentPurposes.EmergencyTreatment,
|
|
47
|
+
actions: [HealthcareBasicSections.PatientSummaryDocument.claim],
|
|
48
|
+
resourceTypes: [ResourceTypesFhirR4.Composition, ResourceTypesFhirR4.DocumentReference],
|
|
49
|
+
}),
|
|
50
|
+
physicianByOrganizationContinuousCare: buildRule({
|
|
51
|
+
identifier: 'urn:uuid:consent-physician-org-treatment',
|
|
52
|
+
actorIdentifier: EXAMPLE_PROVIDER_ORGANIZATION_DID_WEB,
|
|
53
|
+
actorRole: HealthcareActorRoles.Physician,
|
|
54
|
+
purpose: HealthcareConsentPurposes.Treatment,
|
|
55
|
+
actions: [HealthcareBasicSections.Results.claim],
|
|
56
|
+
resourceTypes: [ResourceTypesFhirR4.Composition, ResourceTypesFhirR4.DiagnosticReport],
|
|
57
|
+
}),
|
|
58
|
+
physicianByJurisdictionEmergency: buildRule({
|
|
59
|
+
identifier: 'urn:uuid:consent-physician-jurisdiction-emergency',
|
|
60
|
+
actorIdentifier: EXAMPLE_CONSENT_ACCESS_JURISDICTION,
|
|
61
|
+
actorRole: HealthcareActorRoles.Physician,
|
|
62
|
+
purpose: HealthcareConsentPurposes.EmergencyTreatment,
|
|
63
|
+
actions: [HealthcareBasicSections.PatientSummaryDocument.claim],
|
|
64
|
+
resourceTypes: [ResourceTypesFhirR4.Composition, ResourceTypesFhirR4.DocumentReference],
|
|
65
|
+
}),
|
|
66
|
+
nurseByOrganization: buildRule({
|
|
67
|
+
identifier: 'urn:uuid:consent-nurse-org-treatment',
|
|
68
|
+
actorIdentifier: EXAMPLE_PROVIDER_ORGANIZATION_DID_WEB,
|
|
69
|
+
actorRole: HealthcareActorRoles.NursingProfessional,
|
|
70
|
+
purpose: HealthcareConsentPurposes.Treatment,
|
|
71
|
+
actions: [HealthcareBasicSections.HistoryOfMedicationUse.claim],
|
|
72
|
+
resourceTypes: [ResourceTypesFhirR4.Composition, ResourceTypesFhirR4.MedicationStatement],
|
|
73
|
+
}),
|
|
74
|
+
paramedicByJurisdiction: buildRule({
|
|
75
|
+
identifier: 'urn:uuid:consent-paramedic-jurisdiction-emergency',
|
|
76
|
+
actorIdentifier: EXAMPLE_CONSENT_ACCESS_JURISDICTION,
|
|
77
|
+
actorRole: HealthcareActorRoles.Paramedic,
|
|
78
|
+
purpose: HealthcareConsentPurposes.EmergencyTreatment,
|
|
79
|
+
actions: [HealthcareBasicSections.PatientSummaryDocument.claim],
|
|
80
|
+
resourceTypes: [ResourceTypesFhirR4.Composition, ResourceTypesFhirR4.Observation],
|
|
81
|
+
}),
|
|
82
|
+
directPhysicianDenyInsideAllowedOrganization: buildRule({
|
|
83
|
+
identifier: 'urn:uuid:consent-physician-direct-deny',
|
|
84
|
+
actorIdentifier: EXAMPLE_EMAIL_PROFESSIONAL,
|
|
85
|
+
actorRole: HealthcareActorRoles.Physician,
|
|
86
|
+
decision: 'deny',
|
|
87
|
+
purpose: HealthcareConsentPurposes.Treatment,
|
|
88
|
+
actions: [HealthcareBasicSections.Results.claim],
|
|
89
|
+
resourceTypes: [ResourceTypesFhirR4.DiagnosticReport],
|
|
90
|
+
}),
|
|
91
|
+
relatedPersonByEmail: buildRule({
|
|
92
|
+
identifier: 'urn:uuid:consent-related-person-email',
|
|
93
|
+
actorIdentifier: EXAMPLE_EMAIL_RELATED_PERSON,
|
|
94
|
+
actorRole: 'v3-RoleCode|RESPRSN',
|
|
95
|
+
purpose: HealthcareConsentPurposes.Treatment,
|
|
96
|
+
actions: [HealthcareBasicSections.PatientSummaryDocument.claim],
|
|
97
|
+
resourceTypes: [ResourceTypesFhirR4.Composition, ResourceTypesFhirR4.DocumentReference],
|
|
98
|
+
}),
|
|
99
|
+
revokedPhysicianEmailConsent: buildRule({
|
|
100
|
+
identifier: 'urn:uuid:consent-physician-email-revoked',
|
|
101
|
+
actorIdentifier: EXAMPLE_EMAIL_PROFESSIONAL,
|
|
102
|
+
actorRole: HealthcareActorRoles.Physician,
|
|
103
|
+
purpose: HealthcareConsentPurposes.EmergencyTreatment,
|
|
104
|
+
actions: [HealthcareBasicSections.PatientSummaryDocument.claim],
|
|
105
|
+
periodEnd: '2026-05-01T00:00:00Z',
|
|
106
|
+
}),
|
|
107
|
+
});
|
|
108
|
+
export const EXAMPLE_CONSENT_PHONE_EXTENSION_PENDING = Object.freeze({
|
|
109
|
+
target: 'tel:+34600111222',
|
|
110
|
+
status: 'pending-extension',
|
|
111
|
+
reason: 'telephone actor targeting remains an extension concern unless the sector/runtime explicitly enables it',
|
|
112
|
+
});
|
package/dist/examples/index.d.ts
CHANGED
|
@@ -3,6 +3,9 @@ export * from './organization-controller';
|
|
|
3
3
|
export * from './individual-controller';
|
|
4
4
|
export * from './professional';
|
|
5
5
|
export * from './related-person';
|
|
6
|
+
export * from './consent-access';
|
|
7
|
+
export * from './relationship-access';
|
|
6
8
|
export * from './frontend-session';
|
|
9
|
+
export * from './lifecycle';
|
|
7
10
|
export * from './api-flow-examples';
|
|
8
11
|
export * from './contract-examples';
|
package/dist/examples/index.js
CHANGED
|
@@ -3,6 +3,9 @@ export * from './organization-controller.js';
|
|
|
3
3
|
export * from './individual-controller.js';
|
|
4
4
|
export * from './professional.js';
|
|
5
5
|
export * from './related-person.js';
|
|
6
|
+
export * from './consent-access.js';
|
|
7
|
+
export * from './relationship-access.js';
|
|
6
8
|
export * from './frontend-session.js';
|
|
9
|
+
export * from './lifecycle.js';
|
|
7
10
|
export * from './api-flow-examples.js';
|
|
8
11
|
export * from './contract-examples.js';
|
|
@@ -1,18 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Examples for individual-controller and subject-index bootstrap flows.
|
|
3
|
-
*
|
|
4
|
-
* CORE canonical examples in this file avoid phone-specific subject/controller
|
|
5
|
-
* fields unless the flow truly requires them. Telephone-driven notification or
|
|
6
|
-
* consent targeting is treated as an extension concern (for example UNID GW),
|
|
7
|
-
* not a CORE GW contract requirement.
|
|
8
|
-
*
|
|
9
|
-
* Semantic split:
|
|
10
|
-
*
|
|
11
|
-
* - these examples model the human controller as owner of the individual
|
|
12
|
-
* subject-index organization
|
|
13
|
-
* - legal organization controller/representative examples belong instead to
|
|
14
|
-
* organization activation and VC/member semantics, not to `owner.*` claims
|
|
15
|
-
*/
|
|
16
1
|
export declare const EXAMPLE_INDIVIDUAL_ORGANIZATION_START_INPUT: {
|
|
17
2
|
readonly alternateName: "ana";
|
|
18
3
|
readonly controllerEmail: "ana.parent@example.org";
|
|
@@ -14,9 +14,10 @@
|
|
|
14
14
|
* - legal organization controller/representative examples belong instead to
|
|
15
15
|
* organization activation and VC/member semantics, not to `owner.*` claims
|
|
16
16
|
*/
|
|
17
|
+
import { EXAMPLE_EMAIL_CONTROLLER_INDIVIDUAL } from './shared.js';
|
|
17
18
|
export const EXAMPLE_INDIVIDUAL_ORGANIZATION_START_INPUT = {
|
|
18
19
|
alternateName: 'ana',
|
|
19
|
-
controllerEmail:
|
|
20
|
+
controllerEmail: EXAMPLE_EMAIL_CONTROLLER_INDIVIDUAL,
|
|
20
21
|
timeoutSeconds: 7,
|
|
21
22
|
intervalSeconds: 2,
|
|
22
23
|
};
|