gdc-common-utils-ts 1.6.0 → 1.7.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.
Files changed (47) hide show
  1. package/dist/constants/index.d.ts +2 -0
  2. package/dist/constants/index.js +2 -0
  3. package/dist/constants/service-capabilities.d.ts +53 -0
  4. package/dist/constants/service-capabilities.js +72 -0
  5. package/dist/constants/verifiable-credentials.d.ts +34 -0
  6. package/dist/constants/verifiable-credentials.js +42 -0
  7. package/dist/examples/api-flow-examples.d.ts +1 -0
  8. package/dist/examples/api-flow-examples.js +1 -0
  9. package/dist/examples/consent-access.d.ts +12 -128
  10. package/dist/examples/consent-access.js +27 -18
  11. package/dist/examples/contract-examples.d.ts +1 -0
  12. package/dist/examples/contract-examples.js +1 -0
  13. package/dist/examples/frontend-session.d.ts +0 -4
  14. package/dist/examples/frontend-session.js +13 -7
  15. package/dist/examples/ica-activation-proof.d.ts +55 -0
  16. package/dist/examples/ica-activation-proof.js +67 -0
  17. package/dist/examples/index.d.ts +1 -0
  18. package/dist/examples/index.js +1 -0
  19. package/dist/examples/individual-controller.d.ts +19 -15
  20. package/dist/examples/individual-controller.js +16 -31
  21. package/dist/examples/lifecycle.d.ts +6 -4
  22. package/dist/examples/lifecycle.js +9 -7
  23. package/dist/examples/organization-controller.d.ts +5 -0
  24. package/dist/examples/organization-controller.js +17 -8
  25. package/dist/examples/professional.js +8 -7
  26. package/dist/examples/relationship-access.js +2 -2
  27. package/dist/examples/shared.d.ts +61 -7
  28. package/dist/examples/shared.js +55 -7
  29. package/dist/models/consent-rule.d.ts +1 -0
  30. package/dist/models/consent-rule.js +1 -0
  31. package/dist/models/interoperable-claims/allergy-intolerance-claims.js +1 -0
  32. package/dist/models/interoperable-claims/communication-claims.d.ts +14 -0
  33. package/dist/models/interoperable-claims/communication-claims.js +15 -0
  34. package/dist/models/interoperable-claims/condition-claims.js +1 -0
  35. package/dist/models/interoperable-claims/device-use-statement-claims.js +1 -0
  36. package/dist/models/interoperable-claims/document-reference-claims.js +1 -0
  37. package/dist/models/interoperable-claims/medication-statement-claims.d.ts +17 -0
  38. package/dist/models/interoperable-claims/medication-statement-claims.js +18 -0
  39. package/dist/utils/activation-policy.d.ts +8 -3
  40. package/dist/utils/activation-policy.js +26 -12
  41. package/dist/utils/clinical-resource-converters.js +70 -64
  42. package/dist/utils/communication-document-reference.js +10 -4
  43. package/dist/utils/communication-fhir-r4.js +40 -34
  44. package/dist/utils/consent.d.ts +1 -1
  45. package/dist/utils/consent.js +21 -20
  46. package/dist/utils/vp-token.js +8 -6
  47. package/package.json +1 -1
@@ -1,4 +1,5 @@
1
1
  export * from './shared';
2
+ export * from './ica-activation-proof';
2
3
  export * from './organization-controller';
3
4
  export * from './individual-controller';
4
5
  export * from './professional';
@@ -1,4 +1,5 @@
1
1
  export * from './shared.js';
2
+ export * from './ica-activation-proof.js';
2
3
  export * from './organization-controller.js';
3
4
  export * from './individual-controller.js';
4
5
  export * from './professional.js';
@@ -1,3 +1,19 @@
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
+ import type { ExampleClinicalBundleSearchInput, ExampleLatestIpsSearchInput } from './shared';
1
17
  export declare const EXAMPLE_INDIVIDUAL_ORGANIZATION_START_INPUT: {
2
18
  readonly alternateName: "ana";
3
19
  readonly controllerEmail: "ana.parent@example.org";
@@ -50,7 +66,7 @@ export declare const EXAMPLE_LIVE_CONSENT_GRANT_INPUT: {
50
66
  };
51
67
  readonly actorRole: "ISCO-08|2211";
52
68
  readonly purpose: "TREAT";
53
- readonly actions: readonly ["LOINC|48765-2"];
69
+ readonly actions: readonly [string];
54
70
  };
55
71
  export declare const EXAMPLE_CONSENT_GRANT_RESPONSE: {
56
72
  readonly submit: {
@@ -80,17 +96,5 @@ export declare const EXAMPLE_DIGITAL_TWIN_COMPOSITION_INPUT: {
80
96
  };
81
97
  readonly format: "api";
82
98
  };
83
- export declare const EXAMPLE_CLINICAL_BUNDLE_SEARCH_INPUT: {
84
- readonly subject: "did:web:api.acme.org:individual:123";
85
- readonly section: readonly ["LOINC|60591-5", "LOINC|48765-2"];
86
- readonly includedTypes: readonly ["Composition", "DocumentReference"];
87
- readonly date: {
88
- readonly start: "2026-01-01";
89
- readonly end: "2026-12-31";
90
- };
91
- readonly code: "LOINC|11450-4";
92
- readonly author: "did:web:api.acme.org:professional:1";
93
- };
94
- export declare const EXAMPLE_LATEST_IPS_SEARCH_INPUT: {
95
- readonly subject: "did:web:api.acme.org:individual:123";
96
- };
99
+ export declare const EXAMPLE_CLINICAL_BUNDLE_SEARCH_INPUT: ExampleClinicalBundleSearchInput;
100
+ export declare const EXAMPLE_LATEST_IPS_SEARCH_INPUT: ExampleLatestIpsSearchInput;
@@ -1,20 +1,5 @@
1
1
  // Copyright 2026 Antifraud Services Inc. under the Apache License, Version 2.0.
2
- /**
3
- * Examples for individual-controller and subject-index bootstrap flows.
4
- *
5
- * CORE canonical examples in this file avoid phone-specific subject/controller
6
- * fields unless the flow truly requires them. Telephone-driven notification or
7
- * consent targeting is treated as an extension concern (for example UNID GW),
8
- * not a CORE GW contract requirement.
9
- *
10
- * Semantic split:
11
- *
12
- * - these examples model the human controller as owner of the individual
13
- * subject-index organization
14
- * - legal organization controller/representative examples belong instead to
15
- * organization activation and VC/member semantics, not to `owner.*` claims
16
- */
17
- import { EXAMPLE_EMAIL_CONTROLLER_INDIVIDUAL } from './shared.js';
2
+ import { EXAMPLE_API_ORGANIZATION_DID, EXAMPLE_CLINICAL_CODE_PROBLEM, EXAMPLE_CLINICAL_DATE_RANGE, EXAMPLE_CLINICAL_SECTION_ALLERGIES, EXAMPLE_CLINICAL_SECTION_PATIENT_SUMMARY, EXAMPLE_CONSENT_PURPOSE_TREATMENT, EXAMPLE_EMAIL_CONTROLLER_INDIVIDUAL, EXAMPLE_GENERIC_SUBJECT_DID, EXAMPLE_HEALTHCARE_ACTOR_ROLE_PHYSICIAN, EXAMPLE_HEALTHCARE_JURISDICTION, EXAMPLE_HEALTHCARE_ROLE_PHYSICIAN_TEXT, EXAMPLE_PRACTITIONER_DID, EXAMPLE_PROFESSIONAL_DID, EXAMPLE_SUBJECT_DID, } from './shared.js';
18
3
  export const EXAMPLE_INDIVIDUAL_ORGANIZATION_START_INPUT = {
19
4
  alternateName: 'ana',
20
5
  controllerEmail: EXAMPLE_EMAIL_CONTROLLER_INDIVIDUAL,
@@ -37,18 +22,18 @@ export const EXAMPLE_INDIVIDUAL_ORGANIZATION_ORDER_RESPONSE = {
37
22
  poll: { status: 200, body: {}, attempts: 1 },
38
23
  };
39
24
  export const EXAMPLE_CONSENT_GRANT_INPUT = {
40
- actor: 'did:web:practitioner.example,ES',
41
- actorRole: 'physician',
42
- purpose: 'TREAT',
25
+ actor: `${EXAMPLE_PRACTITIONER_DID},${EXAMPLE_HEALTHCARE_JURISDICTION}`,
26
+ actorRole: EXAMPLE_HEALTHCARE_ROLE_PHYSICIAN_TEXT,
27
+ purpose: EXAMPLE_CONSENT_PURPOSE_TREATMENT,
43
28
  actions: ['read'],
44
- subjectDid: 'did:web:subject.example',
29
+ subjectDid: EXAMPLE_GENERIC_SUBJECT_DID,
45
30
  };
46
31
  export const EXAMPLE_LIVE_CONSENT_GRANT_INPUT = {
47
- subjectDid: 'did:web:api.acme.org:individual:123',
48
- actor: { identifier: 'did:web:api.acme.org' },
49
- actorRole: 'ISCO-08|2211',
50
- purpose: 'TREAT',
51
- actions: ['LOINC|48765-2'],
32
+ subjectDid: EXAMPLE_SUBJECT_DID,
33
+ actor: { identifier: EXAMPLE_API_ORGANIZATION_DID },
34
+ actorRole: EXAMPLE_HEALTHCARE_ACTOR_ROLE_PHYSICIAN,
35
+ purpose: EXAMPLE_CONSENT_PURPOSE_TREATMENT,
36
+ actions: [EXAMPLE_CLINICAL_SECTION_ALLERGIES],
52
37
  };
53
38
  export const EXAMPLE_CONSENT_GRANT_RESPONSE = {
54
39
  submit: { status: 202, body: {} },
@@ -74,13 +59,13 @@ export const EXAMPLE_DIGITAL_TWIN_COMPOSITION_INPUT = {
74
59
  format: 'api',
75
60
  };
76
61
  export const EXAMPLE_CLINICAL_BUNDLE_SEARCH_INPUT = {
77
- subject: 'did:web:api.acme.org:individual:123',
78
- section: ['LOINC|60591-5', 'LOINC|48765-2'],
62
+ subject: EXAMPLE_SUBJECT_DID,
63
+ section: [EXAMPLE_CLINICAL_SECTION_PATIENT_SUMMARY, EXAMPLE_CLINICAL_SECTION_ALLERGIES],
79
64
  includedTypes: ['Composition', 'DocumentReference'],
80
- date: { start: '2026-01-01', end: '2026-12-31' },
81
- code: 'LOINC|11450-4',
82
- author: 'did:web:api.acme.org:professional:1',
65
+ date: EXAMPLE_CLINICAL_DATE_RANGE,
66
+ code: EXAMPLE_CLINICAL_CODE_PROBLEM,
67
+ author: EXAMPLE_PROFESSIONAL_DID,
83
68
  };
84
69
  export const EXAMPLE_LATEST_IPS_SEARCH_INPUT = {
85
- subject: 'did:web:api.acme.org:individual:123',
70
+ subject: EXAMPLE_SUBJECT_DID,
86
71
  };
@@ -16,6 +16,8 @@ export declare const EXAMPLE_LIFECYCLE_OPERATIONS: {
16
16
  * These are intentionally synthetic and stable. Repositories should override
17
17
  * them at runtime with environment variables, UI form values, or test fixtures
18
18
  * rather than committing personal data.
19
+ *
20
+ * Keep all repeated actor/section/code fixtures imported from `./shared`.
19
21
  */
20
22
  export declare const EXAMPLE_LIFECYCLE_PLACEHOLDERS: {
21
23
  readonly tenantId: "acme-id";
@@ -212,7 +214,7 @@ export declare const EXAMPLE_CONSENT_ENABLE_MESSAGE: {
212
214
  readonly "Consent.actor-identifier": "{{consentActorIdentifier}}";
213
215
  readonly "Consent.actor-role": "ISCO-08|2211";
214
216
  readonly "Consent.purpose": "TREAT";
215
- readonly "Consent.action": "LOINC|48765-2";
217
+ readonly "Consent.action": string;
216
218
  readonly "Consent.decision": "permit";
217
219
  };
218
220
  };
@@ -231,7 +233,7 @@ export declare const EXAMPLE_CONSENT_DISABLE_MESSAGE: {
231
233
  readonly "Consent.actor-identifier": "{{consentActorIdentifier}}";
232
234
  readonly "Consent.actor-role": "ISCO-08|2211";
233
235
  readonly "Consent.purpose": "TREAT";
234
- readonly "Consent.action": "LOINC|48765-2";
236
+ readonly "Consent.action": string;
235
237
  readonly "Consent.decision": "permit";
236
238
  };
237
239
  };
@@ -456,7 +458,7 @@ export declare const EXAMPLE_LIFECYCLE_REFERENCE: {
456
458
  readonly "Consent.actor-identifier": "{{consentActorIdentifier}}";
457
459
  readonly "Consent.actor-role": "ISCO-08|2211";
458
460
  readonly "Consent.purpose": "TREAT";
459
- readonly "Consent.action": "LOINC|48765-2";
461
+ readonly "Consent.action": string;
460
462
  readonly "Consent.decision": "permit";
461
463
  };
462
464
  };
@@ -475,7 +477,7 @@ export declare const EXAMPLE_LIFECYCLE_REFERENCE: {
475
477
  readonly "Consent.actor-identifier": "{{consentActorIdentifier}}";
476
478
  readonly "Consent.actor-role": "ISCO-08|2211";
477
479
  readonly "Consent.purpose": "TREAT";
478
- readonly "Consent.action": "LOINC|48765-2";
480
+ readonly "Consent.action": string;
479
481
  readonly "Consent.decision": "permit";
480
482
  };
481
483
  };
@@ -1,7 +1,7 @@
1
1
  // Copyright 2026 Antifraud Services Inc. under the Apache License, Version 2.0.
2
2
  import { ClaimsOrganizationSchemaorg, ClaimsPersonSchemaorg, } from '../constants/schemaorg.js';
3
3
  import { ClaimConsent } from '../models/consent-rule.js';
4
- import { EXAMPLE_EMAIL_CONTROLLER_INDIVIDUAL, EXAMPLE_EMAIL_CONTROLLER_ORG, EXAMPLE_JURISDICTION, EXAMPLE_SECTOR, EXAMPLE_TENANT_IDENTIFIER, } from './shared.js';
4
+ import { EXAMPLE_EMAIL_CONTROLLER_INDIVIDUAL, EXAMPLE_EMAIL_CONTROLLER_ORG, EXAMPLE_CLINICAL_SECTION_ALLERGIES, EXAMPLE_CONSENT_PURPOSE_TREATMENT, EXAMPLE_HEALTHCARE_ACTOR_ROLE_PHYSICIAN, EXAMPLE_JURISDICTION, EXAMPLE_SECTOR, EXAMPLE_TENANT_IDENTIFIER, } from './shared.js';
5
5
  /**
6
6
  * Canonical lifecycle naming for `v1`.
7
7
  *
@@ -20,6 +20,8 @@ export const EXAMPLE_LIFECYCLE_OPERATIONS = {
20
20
  * These are intentionally synthetic and stable. Repositories should override
21
21
  * them at runtime with environment variables, UI form values, or test fixtures
22
22
  * rather than committing personal data.
23
+ *
24
+ * Keep all repeated actor/section/code fixtures imported from `./shared`.
23
25
  */
24
26
  export const EXAMPLE_LIFECYCLE_PLACEHOLDERS = {
25
27
  tenantId: EXAMPLE_TENANT_IDENTIFIER,
@@ -214,9 +216,9 @@ export const EXAMPLE_CONSENT_ENABLE_MESSAGE = {
214
216
  [ClaimConsent.identifier]: EXAMPLE_LIFECYCLE_PLACEHOLDERS.consentIdentifier,
215
217
  [ClaimConsent.subject]: EXAMPLE_LIFECYCLE_PLACEHOLDERS.individualSubjectDid,
216
218
  [ClaimConsent.actorIdentifier]: EXAMPLE_LIFECYCLE_PLACEHOLDERS.consentActorIdentifier,
217
- [ClaimConsent.actorRole]: 'ISCO-08|2211',
218
- [ClaimConsent.purpose]: 'TREAT',
219
- [ClaimConsent.action]: 'LOINC|48765-2',
219
+ [ClaimConsent.actorRole]: EXAMPLE_HEALTHCARE_ACTOR_ROLE_PHYSICIAN,
220
+ [ClaimConsent.purpose]: EXAMPLE_CONSENT_PURPOSE_TREATMENT,
221
+ [ClaimConsent.action]: EXAMPLE_CLINICAL_SECTION_ALLERGIES,
220
222
  [ClaimConsent.decision]: 'permit',
221
223
  },
222
224
  };
@@ -233,9 +235,9 @@ export const EXAMPLE_CONSENT_DISABLE_MESSAGE = {
233
235
  [ClaimConsent.identifier]: EXAMPLE_LIFECYCLE_PLACEHOLDERS.consentIdentifier,
234
236
  [ClaimConsent.subject]: EXAMPLE_LIFECYCLE_PLACEHOLDERS.individualSubjectDid,
235
237
  [ClaimConsent.actorIdentifier]: EXAMPLE_LIFECYCLE_PLACEHOLDERS.consentActorIdentifier,
236
- [ClaimConsent.actorRole]: 'ISCO-08|2211',
237
- [ClaimConsent.purpose]: 'TREAT',
238
- [ClaimConsent.action]: 'LOINC|48765-2',
238
+ [ClaimConsent.actorRole]: EXAMPLE_HEALTHCARE_ACTOR_ROLE_PHYSICIAN,
239
+ [ClaimConsent.purpose]: EXAMPLE_CONSENT_PURPOSE_TREATMENT,
240
+ [ClaimConsent.action]: EXAMPLE_CLINICAL_SECTION_ALLERGIES,
239
241
  [ClaimConsent.decision]: 'permit',
240
242
  },
241
243
  };
@@ -1,5 +1,9 @@
1
1
  /**
2
2
  * Examples for organization-controller and host-onboarding flows.
3
+ *
4
+ * Contract note:
5
+ * repeated synthetic DIDs, roles, and activation fixtures must come from
6
+ * `./shared`, never be re-hardcoded inline in public example payloads.
3
7
  */
4
8
  export declare const EXAMPLE_ACTIVATE_ORGANIZATION_FROM_ICA_PROOF_INPUT: {
5
9
  readonly vpToken: "<ica-proof-token>";
@@ -39,6 +43,7 @@ export declare const EXAMPLE_ACTIVATE_ORGANIZATION_FROM_ICA_PROOF_INPUT: {
39
43
  readonly "org.schema.Service.category": "health-care";
40
44
  readonly "org.schema.Service.identifier": "did:web:public.acme.org";
41
45
  readonly "org.schema.Service.url": `https://operator.example.net/acme/cds-${string}/v1/health-care`;
46
+ readonly "org.schema.Service.serviceType": string | undefined;
42
47
  };
43
48
  };
44
49
  export declare const EXAMPLE_GW_ORGANIZATION_ACTIVATE_PAYLOAD: {
@@ -1,9 +1,14 @@
1
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.
2
3
  import { ClaimsOrganizationSchemaorg, ClaimsPersonSchemaorg, ClaimsServiceSchemaorg, } from '../constants/schemaorg.js';
3
- import { EXAMPLE_CONTROLLER_BINDING } from './shared.js';
4
- import { EXAMPLE_SECTOR, EXAMPLE_JURISDICTION, EXAMPLE_EMAIL_CONTROLLER_ORG } from './shared.js';
4
+ import { ServiceCapabilityToken, serializeServiceCapabilityTokens, } from '../constants/service-capabilities.js';
5
+ import { EXAMPLE_CONTROLLER_BINDING, EXAMPLE_DEVICE_CLIENT_ID, EXAMPLE_EMAIL_CONTROLLER_ORG, EXAMPLE_EMPLOYEE_ACTIVATION_CODE, EXAMPLE_HEALTHCARE_ACTOR_ROLE_RECEPTIONIST, EXAMPLE_JURISDICTION, EXAMPLE_ORGANIZATION_CONTROLLER_ROLE, EXAMPLE_SECTOR, EXAMPLE_SERVICE_PUBLIC_DID, } from './shared.js';
5
6
  /**
6
7
  * Examples for organization-controller and host-onboarding flows.
8
+ *
9
+ * Contract note:
10
+ * repeated synthetic DIDs, roles, and activation fixtures must come from
11
+ * `./shared`, never be re-hardcoded inline in public example payloads.
7
12
  */
8
13
  export const EXAMPLE_ACTIVATE_ORGANIZATION_FROM_ICA_PROOF_INPUT = {
9
14
  vpToken: '<ica-proof-token>',
@@ -16,10 +21,14 @@ export const EXAMPLE_ACTIVATE_ORGANIZATION_FROM_ICA_PROOF_INPUT = {
16
21
  [ClaimsOrganizationSchemaorg.addressCountry]: EXAMPLE_JURISDICTION,
17
22
  [ClaimsOrganizationSchemaorg.taxId]: 'VATES-B00112233',
18
23
  [ClaimsPersonSchemaorg.email]: EXAMPLE_EMAIL_CONTROLLER_ORG,
19
- [ClaimsPersonSchemaorg.hasOccupationalRoleValue]: 'RESPRSN',
24
+ [ClaimsPersonSchemaorg.hasOccupationalRoleValue]: EXAMPLE_ORGANIZATION_CONTROLLER_ROLE,
20
25
  [ClaimsServiceSchemaorg.category]: EXAMPLE_SECTOR,
21
- [ClaimsServiceSchemaorg.identifier]: 'did:web:public.acme.org',
26
+ [ClaimsServiceSchemaorg.identifier]: EXAMPLE_SERVICE_PUBLIC_DID,
22
27
  [ClaimsServiceSchemaorg.url]: `https://operator.example.net/acme/cds-${String(EXAMPLE_JURISDICTION).toLowerCase()}/v1/${EXAMPLE_SECTOR}`,
28
+ [ClaimsServiceSchemaorg.serviceType]: serializeServiceCapabilityTokens([
29
+ ServiceCapabilityToken.IndexingCruds,
30
+ ServiceCapabilityToken.DigitalTwinReadSearch,
31
+ ]),
23
32
  },
24
33
  };
25
34
  export const EXAMPLE_GW_ORGANIZATION_ACTIVATE_PAYLOAD = {
@@ -56,7 +65,7 @@ export const EXAMPLE_ORGANIZATION_EMPLOYEE_INPUT = {
56
65
  employeeClaims: {
57
66
  [ClaimsPersonSchemaorg.identifier]: 'urn:uuid:11b2c3d4-e5f6-7890-1234-567890abcdef',
58
67
  [ClaimsPersonSchemaorg.email]: 'receptionist1@acme.org',
59
- [ClaimsPersonSchemaorg.hasOccupationalRoleValue]: 'ISCO-08|4226',
68
+ [ClaimsPersonSchemaorg.hasOccupationalRoleValue]: EXAMPLE_HEALTHCARE_ACTOR_ROLE_RECEPTIONIST,
60
69
  },
61
70
  };
62
71
  export const EXAMPLE_LIVE_EMPLOYEE_INPUT = {
@@ -64,11 +73,11 @@ export const EXAMPLE_LIVE_EMPLOYEE_INPUT = {
64
73
  '@context': 'org.schema',
65
74
  [ClaimsPersonSchemaorg.identifier]: 'urn:uuid:11b2c3d4-e5f6-7890-1234-567890abcdef',
66
75
  [ClaimsPersonSchemaorg.email]: EXAMPLE_EMAIL_CONTROLLER_ORG,
67
- [ClaimsPersonSchemaorg.hasOccupationalRoleValue]: 'RESPRSN',
76
+ [ClaimsPersonSchemaorg.hasOccupationalRoleValue]: EXAMPLE_ORGANIZATION_CONTROLLER_ROLE,
68
77
  },
69
78
  };
70
79
  export const EXAMPLE_EMPLOYEE_DEVICE_ACTIVATION_INPUT = {
71
- activationCode: 'ACT-001',
80
+ activationCode: EXAMPLE_EMPLOYEE_ACTIVATION_CODE,
72
81
  idToken: 'employee-id-token-001',
73
82
  dcrPayload: {
74
83
  application_type: 'web',
@@ -80,5 +89,5 @@ export const EXAMPLE_EMPLOYEE_DEVICE_EXCHANGE_RESPONSE = {
80
89
  };
81
90
  export const EXAMPLE_EMPLOYEE_DEVICE_DCR_RESPONSE = {
82
91
  submit: { status: 202, body: {} },
83
- poll: { status: 200, body: { body: { client_id: 'did:web:device-001' } }, attempts: 1 },
92
+ poll: { status: 200, body: { body: { client_id: EXAMPLE_DEVICE_CLIENT_ID } }, attempts: 1 },
84
93
  };
@@ -3,6 +3,7 @@ import { HealthcareActorRoles, HealthcareBasicSections, HealthcareConsentPurpose
3
3
  import { ResourceTypesFhirR4 } from '../constants/fhir-resource-types.js';
4
4
  import { SmartGatewayScopesFhirR4 } from '../constants/smart.js';
5
5
  import { buildSmartCompositionReadScope } from '../utils/smart-scope.js';
6
+ import { EXAMPLE_CLINICAL_SECTION_ALLERGIES, EXAMPLE_EMAIL_PROFESSIONAL, EXAMPLE_HEALTHCARE_JURISDICTION, EXAMPLE_PATIENT_DID, EXAMPLE_PROVIDER_ORGANIZATION_URL, EXAMPLE_SUBJECT_DID, } from './shared.js';
6
7
  /**
7
8
  * Examples for professional runtime access flows.
8
9
  *
@@ -17,14 +18,14 @@ import { buildSmartCompositionReadScope } from '../utils/smart-scope.js';
17
18
  * examples, where the main concern is identity/bootstrap rather than
18
19
  * professional clinical access permissions.
19
20
  */
20
- const EXAMPLE_SMART_SUBJECT_DID = 'did:web:api.acme.org:individual:123';
21
- const EXAMPLE_PHYSICIAN_EMAIL = 'doctor.oncall@example.org';
22
- const EXAMPLE_PROVIDER_ORG_URL = 'https://hospital.acme.org';
23
- const EXAMPLE_JURISDICTION = 'ES';
21
+ const EXAMPLE_SMART_SUBJECT_DID = EXAMPLE_SUBJECT_DID;
22
+ const EXAMPLE_PHYSICIAN_EMAIL = EXAMPLE_EMAIL_PROFESSIONAL;
23
+ const EXAMPLE_PROVIDER_ORG_URL = EXAMPLE_PROVIDER_ORGANIZATION_URL;
24
+ const EXAMPLE_JURISDICTION = EXAMPLE_HEALTHCARE_JURISDICTION;
24
25
  const EXAMPLE_CANONICAL_SMART_READ_SCOPES = [
25
26
  buildSmartCompositionReadScope({
26
27
  subjectDid: EXAMPLE_SMART_SUBJECT_DID,
27
- sections: 'LOINC|48765-2',
28
+ sections: EXAMPLE_CLINICAL_SECTION_ALLERGIES,
28
29
  }),
29
30
  ];
30
31
  const EXAMPLE_CANONICAL_SMART_SCOPES = [
@@ -77,11 +78,11 @@ export const EXAMPLE_TOKEN_EXCHANGE_RESPONSE = {
77
78
  },
78
79
  };
79
80
  export const EXAMPLE_SEND_COMMUNICATION_INPUT = {
80
- subject: 'did:web:patient.example',
81
+ subject: EXAMPLE_PATIENT_DID,
81
82
  text: 'Message body',
82
83
  };
83
84
  export const EXAMPLE_SEARCH_CLINICAL_BUNDLE_INPUT = {
84
- subject: 'did:web:patient.example',
85
+ subject: EXAMPLE_PATIENT_DID,
85
86
  includedTypes: ['Communication', 'DocumentReference'],
86
87
  };
87
88
  /**
@@ -1,6 +1,6 @@
1
1
  // Copyright 2026 Antifraud Services Inc. under the Apache License, Version 2.0.
2
2
  import { HealthcareConsentPurposes } from '../constants/healthcare.js';
3
- import { EXAMPLE_JURISDICTION, EXAMPLE_SECTOR } from './shared.js';
3
+ import { EXAMPLE_HEALTHCARE_ACTOR_ROLE_PHYSICIAN, EXAMPLE_JURISDICTION, EXAMPLE_SECTOR, } from './shared.js';
4
4
  import { EXAMPLE_EMAIL_PROFESSIONAL, EXAMPLE_EMAIL_RELATED_PERSON, EXAMPLE_INDIVIDUAL_DID_WEB, } from './consent-access.js';
5
5
  export const EXAMPLE_RELATIONSHIP_CHANNEL_INVITATION_INPUT = {
6
6
  tenantId: 'acme-id',
@@ -38,7 +38,7 @@ export const EXAMPLE_RELATIONSHIP_PROFESSIONAL_INVITATION_INPUT = {
38
38
  subjectKind: 'person',
39
39
  actorKind: 'professional',
40
40
  actorIdentifier: EXAMPLE_EMAIL_PROFESSIONAL,
41
- actorRole: 'ISCO-08|2211',
41
+ actorRole: EXAMPLE_HEALTHCARE_ACTOR_ROLE_PHYSICIAN,
42
42
  deliveryChannel: 'email',
43
43
  deliveryTarget: EXAMPLE_EMAIL_PROFESSIONAL,
44
44
  purpose: HealthcareConsentPurposes.Treatment,
@@ -1,5 +1,12 @@
1
1
  /**
2
2
  * Shared low-level example fragments reused by multiple flow-specific example modules.
3
+ *
4
+ * Non-negotiable rule:
5
+ *
6
+ * - example DIDs, emails, actor identifiers, sections, codes, and date windows
7
+ * must be imported from this module
8
+ * - example files must not re-hardcode those fixture values inline
9
+ * - all values below are synthetic documentation/test fixtures, never real data
3
10
  */
4
11
  export declare const EXAMPLE_TENANT_IDENTIFIER: "acme-id";
5
12
  export declare const EXAMPLE_JURISDICTION: "ES";
@@ -18,6 +25,53 @@ export declare const EXAMPLE_HOST_ROUTE_CONTEXT: {
18
25
  export declare const EXAMPLE_CONTROLLER_DID: "did:web:people.acme.org:controllers:primary";
19
26
  export declare const EXAMPLE_CONTROLLER_EMAIL: "controller@acme.org";
20
27
  export declare const EXAMPLE_CONTROLLER_SAME_AS: "mailto:controller@acme.org";
28
+ export declare const EXAMPLE_API_ORGANIZATION_DID: "did:web:api.acme.org";
29
+ export declare const EXAMPLE_SERVICE_PUBLIC_DID: "did:web:public.acme.org";
30
+ export declare const EXAMPLE_SUBJECT_DID: "did:web:api.acme.org:individual:123";
31
+ export declare const EXAMPLE_PROFESSIONAL_DID: "did:web:api.acme.org:professional:1";
32
+ export declare const EXAMPLE_PROVIDER_ORGANIZATION_DID: "did:web:hospital.acme.org";
33
+ export declare const EXAMPLE_PROVIDER_ORGANIZATION_URL: "https://hospital.acme.org";
34
+ export declare const EXAMPLE_PATIENT_DID: "did:web:patient.example";
35
+ export declare const EXAMPLE_PROFILE_PROVIDER_DID: "did:web:provider.example.org";
36
+ export declare const EXAMPLE_PROFILE_ORGANIZATION_DID: "did:web:org.example";
37
+ export declare const EXAMPLE_PROFILE_ID: "profile-1";
38
+ export declare const EXAMPLE_PROFILE_EMAIL: "user@example.com";
39
+ export declare const EXAMPLE_PRACTITIONER_DID: "did:web:practitioner.example";
40
+ export declare const EXAMPLE_GENERIC_SUBJECT_DID: "did:web:subject.example";
41
+ export declare const EXAMPLE_EMAIL_PROFESSIONAL: "doctor.oncall@example.org";
42
+ export declare const EXAMPLE_EMAIL_RELATED_PERSON: "parent.guardian@example.org";
43
+ export declare const EXAMPLE_HEALTHCARE_JURISDICTION: "ES";
44
+ export declare const EXAMPLE_ORGANIZATION_CONTROLLER_ROLE: "RESPRSN";
45
+ export declare const EXAMPLE_HEALTHCARE_ACTOR_ROLE_PHYSICIAN: "ISCO-08|2211";
46
+ export declare const EXAMPLE_HEALTHCARE_ACTOR_ROLE_RECEPTIONIST: "ISCO-08|4226";
47
+ export declare const EXAMPLE_HEALTHCARE_ROLE_PHYSICIAN_TEXT: "physician";
48
+ export declare const EXAMPLE_RELATED_PERSON_ROLE: "v3-RoleCode|RESPRSN";
49
+ export declare const EXAMPLE_CLINICAL_SECTION_RESULTS: "LOINC|30954-2";
50
+ export declare const EXAMPLE_CLINICAL_SECTION_PATIENT_SUMMARY: "LOINC|60591-5";
51
+ export declare const EXAMPLE_CLINICAL_SECTION_HISTORY_MEDICATION: "LOINC|10160-0";
52
+ export declare const EXAMPLE_CLINICAL_SECTION_ALLERGIES: string;
53
+ export declare const EXAMPLE_CLINICAL_CODE_PROBLEM: "LOINC|11450-4";
54
+ export declare const EXAMPLE_CONSENT_DATE: "2026-05-20";
55
+ export declare const EXAMPLE_CONSENT_PERIOD_END: "2026-05-01T00:00:00Z";
56
+ export declare const EXAMPLE_CONSENT_PURPOSE_TREATMENT: "TREAT";
57
+ export declare const EXAMPLE_EMPLOYEE_ACTIVATION_CODE: "ACT-001";
58
+ export declare const EXAMPLE_DEVICE_CLIENT_ID: "did:web:device-001";
59
+ export type ExampleDateRange = Readonly<{
60
+ start: string;
61
+ end: string;
62
+ }>;
63
+ export declare const EXAMPLE_CLINICAL_DATE_RANGE: ExampleDateRange;
64
+ export type ExampleClinicalBundleSearchInput = Readonly<{
65
+ subject: string;
66
+ section: readonly string[];
67
+ includedTypes: readonly string[];
68
+ date: ExampleDateRange;
69
+ code: string;
70
+ author: string;
71
+ }>;
72
+ export type ExampleLatestIpsSearchInput = Readonly<{
73
+ subject: string;
74
+ }>;
21
75
  export declare const EXAMPLE_CONTROLLER_SIGN_KEY: {
22
76
  readonly kid: "controller-es384-001";
23
77
  readonly kty: "EC";
@@ -72,7 +126,7 @@ export declare const EXAMPLE_CONTROLLER_BINDING: {
72
126
  };
73
127
  };
74
128
  export declare function buildExampleCommunicationIngestionPayload({ subjectDid, sent, ipsBundleBase64, }?: {
75
- subjectDid?: string | undefined;
129
+ subjectDid?: "did:web:api.acme.org:individual:123" | undefined;
76
130
  sent?: string | undefined;
77
131
  ipsBundleBase64?: string | undefined;
78
132
  }): {
@@ -104,18 +158,18 @@ export declare function buildExampleCommunicationIngestionPayload({ subjectDid,
104
158
  meta: {
105
159
  claims: {
106
160
  '@context': string;
107
- 'Communication.category': string;
108
- 'Communication.subject': string;
109
- 'Communication.sent': string;
110
- 'Communication.content-attachment-type': string;
111
- 'Communication.note': string;
161
+ "Communication.category": string;
162
+ "Communication.subject": "did:web:api.acme.org:individual:123";
163
+ "Communication.sent": string;
164
+ "Communication.content-attachment-type": string;
165
+ "Communication.text": string;
112
166
  };
113
167
  };
114
168
  };
115
169
  }[];
116
170
  };
117
171
  };
118
- export declare function buildExampleDocumentReferenceSearchPayload(subjectDid?: string): {
172
+ export declare function buildExampleDocumentReferenceSearchPayload(subjectDid?: "did:web:api.acme.org:individual:123"): {
119
173
  thid: string;
120
174
  body: {
121
175
  resourceType: string;
@@ -1,7 +1,17 @@
1
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.
2
3
  import { DataspaceSectors } from '../constants/sectors.js';
4
+ import { HealthcareActorRoles, HealthcareBasicSections, HealthcareConsentPurposes, } from '../constants/healthcare.js';
5
+ import { CommunicationClaim } from '../models/interoperable-claims/communication-claims.js';
3
6
  /**
4
7
  * Shared low-level example fragments reused by multiple flow-specific example modules.
8
+ *
9
+ * Non-negotiable rule:
10
+ *
11
+ * - example DIDs, emails, actor identifiers, sections, codes, and date windows
12
+ * must be imported from this module
13
+ * - example files must not re-hardcode those fixture values inline
14
+ * - all values below are synthetic documentation/test fixtures, never real data
5
15
  */
6
16
  export const EXAMPLE_TENANT_IDENTIFIER = 'acme-id';
7
17
  export const EXAMPLE_JURISDICTION = 'ES';
@@ -20,6 +30,41 @@ export const EXAMPLE_HOST_ROUTE_CONTEXT = {
20
30
  export const EXAMPLE_CONTROLLER_DID = 'did:web:people.acme.org:controllers:primary';
21
31
  export const EXAMPLE_CONTROLLER_EMAIL = EXAMPLE_EMAIL_CONTROLLER_ORG;
22
32
  export const EXAMPLE_CONTROLLER_SAME_AS = `mailto:${EXAMPLE_CONTROLLER_EMAIL}`;
33
+ export const EXAMPLE_API_ORGANIZATION_DID = 'did:web:api.acme.org';
34
+ export const EXAMPLE_SERVICE_PUBLIC_DID = 'did:web:public.acme.org';
35
+ export const EXAMPLE_SUBJECT_DID = 'did:web:api.acme.org:individual:123';
36
+ export const EXAMPLE_PROFESSIONAL_DID = 'did:web:api.acme.org:professional:1';
37
+ export const EXAMPLE_PROVIDER_ORGANIZATION_DID = 'did:web:hospital.acme.org';
38
+ export const EXAMPLE_PROVIDER_ORGANIZATION_URL = 'https://hospital.acme.org';
39
+ export const EXAMPLE_PATIENT_DID = 'did:web:patient.example';
40
+ export const EXAMPLE_PROFILE_PROVIDER_DID = 'did:web:provider.example.org';
41
+ export const EXAMPLE_PROFILE_ORGANIZATION_DID = 'did:web:org.example';
42
+ export const EXAMPLE_PROFILE_ID = 'profile-1';
43
+ export const EXAMPLE_PROFILE_EMAIL = 'user@example.com';
44
+ export const EXAMPLE_PRACTITIONER_DID = 'did:web:practitioner.example';
45
+ export const EXAMPLE_GENERIC_SUBJECT_DID = 'did:web:subject.example';
46
+ export const EXAMPLE_EMAIL_PROFESSIONAL = 'doctor.oncall@example.org';
47
+ export const EXAMPLE_EMAIL_RELATED_PERSON = 'parent.guardian@example.org';
48
+ export const EXAMPLE_HEALTHCARE_JURISDICTION = 'ES';
49
+ export const EXAMPLE_ORGANIZATION_CONTROLLER_ROLE = 'RESPRSN';
50
+ export const EXAMPLE_HEALTHCARE_ACTOR_ROLE_PHYSICIAN = HealthcareActorRoles.Physician;
51
+ export const EXAMPLE_HEALTHCARE_ACTOR_ROLE_RECEPTIONIST = 'ISCO-08|4226';
52
+ export const EXAMPLE_HEALTHCARE_ROLE_PHYSICIAN_TEXT = 'physician';
53
+ export const EXAMPLE_RELATED_PERSON_ROLE = 'v3-RoleCode|RESPRSN';
54
+ export const EXAMPLE_CLINICAL_SECTION_RESULTS = 'LOINC|30954-2';
55
+ export const EXAMPLE_CLINICAL_SECTION_PATIENT_SUMMARY = 'LOINC|60591-5';
56
+ export const EXAMPLE_CLINICAL_SECTION_HISTORY_MEDICATION = 'LOINC|10160-0';
57
+ export const EXAMPLE_CLINICAL_SECTION_ALLERGIES = HealthcareBasicSections.AllergiesAndIntolerances.claim;
58
+ export const EXAMPLE_CLINICAL_CODE_PROBLEM = 'LOINC|11450-4';
59
+ export const EXAMPLE_CONSENT_DATE = '2026-05-20';
60
+ export const EXAMPLE_CONSENT_PERIOD_END = '2026-05-01T00:00:00Z';
61
+ export const EXAMPLE_CONSENT_PURPOSE_TREATMENT = HealthcareConsentPurposes.Treatment;
62
+ export const EXAMPLE_EMPLOYEE_ACTIVATION_CODE = 'ACT-001';
63
+ export const EXAMPLE_DEVICE_CLIENT_ID = 'did:web:device-001';
64
+ export const EXAMPLE_CLINICAL_DATE_RANGE = {
65
+ start: '2026-01-01',
66
+ end: '2026-12-31',
67
+ };
23
68
  export const EXAMPLE_CONTROLLER_SIGN_KEY = {
24
69
  kid: 'controller-es384-001',
25
70
  kty: 'EC',
@@ -47,7 +92,10 @@ export const EXAMPLE_CONTROLLER_BINDING = {
47
92
  publicKeyJwk: EXAMPLE_CONTROLLER_SIGN_KEY,
48
93
  jwks: EXAMPLE_CONTROLLER_PUBLIC_KEYS,
49
94
  };
50
- export function buildExampleCommunicationIngestionPayload({ subjectDid = 'did:web:api.acme.org:individual:123', sent = '2026-05-22T10:00:00Z', ipsBundleBase64 = '<base64-ips-bundle>', } = {}) {
95
+ export function buildExampleCommunicationIngestionPayload({ subjectDid = EXAMPLE_SUBJECT_DID, sent = '2026-05-22T10:00:00Z', ipsBundleBase64 = '<base64-ips-bundle>', } = {}) {
96
+ // Good practice note:
97
+ // Communication claim keys in examples must come from `CommunicationClaim`
98
+ // instead of repeating raw `Communication.*` strings inline.
51
99
  return {
52
100
  body: {
53
101
  data: [
@@ -76,11 +124,11 @@ export function buildExampleCommunicationIngestionPayload({ subjectDid = 'did:we
76
124
  meta: {
77
125
  claims: {
78
126
  '@context': 'org.hl7.fhir.r4',
79
- 'Communication.category': 'http://terminology.hl7.org/CodeSystem/communication-category|notification',
80
- 'Communication.subject': subjectDid,
81
- 'Communication.sent': sent,
82
- 'Communication.content-attachment-type': 'application/fhir+json',
83
- 'Communication.note': 'IPS ingestion request',
127
+ [CommunicationClaim.Category]: 'http://terminology.hl7.org/CodeSystem/communication-category|notification',
128
+ [CommunicationClaim.Subject]: subjectDid,
129
+ [CommunicationClaim.Sent]: sent,
130
+ [CommunicationClaim.ContentAttachmentType]: 'application/fhir+json',
131
+ [CommunicationClaim.Text]: 'IPS ingestion request',
84
132
  },
85
133
  },
86
134
  },
@@ -89,7 +137,7 @@ export function buildExampleCommunicationIngestionPayload({ subjectDid = 'did:we
89
137
  },
90
138
  };
91
139
  }
92
- export function buildExampleDocumentReferenceSearchPayload(subjectDid = 'did:web:api.acme.org:individual:123') {
140
+ export function buildExampleDocumentReferenceSearchPayload(subjectDid = EXAMPLE_SUBJECT_DID) {
93
141
  return {
94
142
  thid: 'search-documentreference-example',
95
143
  body: {
@@ -2,6 +2,7 @@ export declare enum ClaimConsent {
2
2
  'decision' = "Consent.decision",
3
3
  'action' = "Consent.action",
4
4
  'category' = "Consent.category",
5
+ 'resourceType' = "Consent.resourceType",
5
6
  'subject' = "Consent.subject",
6
7
  'actorIdentifier' = "Consent.actor-identifier",
7
8
  'actorRole' = "Consent.actor-role",
@@ -4,6 +4,7 @@ export var ClaimConsent;
4
4
  ClaimConsent["decision"] = "Consent.decision";
5
5
  ClaimConsent["action"] = "Consent.action";
6
6
  ClaimConsent["category"] = "Consent.category";
7
+ ClaimConsent["resourceType"] = "Consent.resourceType";
7
8
  ClaimConsent["subject"] = "Consent.subject";
8
9
  ClaimConsent["actorIdentifier"] = "Consent.actor-identifier";
9
10
  ClaimConsent["actorRole"] = "Consent.actor-role";
@@ -1,5 +1,6 @@
1
1
  // Copyright 2026 Conéctate Soluciones y Aplicaciones SL under the Apache License, Version 2.0.
2
2
  // File: src/models/interoperable-claims/allergy-intolerance-claims.ts
3
+ // Always create JSDoc, do not use strings inline in keys nor values, use types instead, and reuse the data test examples.
3
4
  export const AllergyIntoleranceClaim = {
4
5
  Identifier: 'AllergyIntolerance.identifier',
5
6
  Subject: 'AllergyIntolerance.subject',
@@ -1,4 +1,16 @@
1
+ /**
2
+ * Canonical flat claim keys for FHIR `Communication`.
3
+ *
4
+ * Good practice note:
5
+ * - any code, examples, scripts, or tests that write/read reusable
6
+ * `Communication.*` claims must import these keys instead of re-hardcoding
7
+ * string literals inline
8
+ * - legacy aliases such as `Communication.partOf` may still appear in
9
+ * compatibility readers, but new code must use the canonical key constants
10
+ */
1
11
  export declare const CommunicationClaim: {
12
+ readonly Category: "Communication.category";
13
+ readonly Status: "Communication.status";
2
14
  readonly Identifier: "Communication.identifier";
3
15
  readonly Subject: "Communication.subject";
4
16
  readonly Recipient: "Communication.recipient";
@@ -7,9 +19,11 @@ export declare const CommunicationClaim: {
7
19
  readonly NoteText: "Communication.note-text";
8
20
  readonly Text: "Communication.text";
9
21
  readonly ContentReference: "Communication.content-reference";
22
+ readonly ContentCode: "Communication.content-code";
10
23
  readonly ContentAttachmentData: "Communication.content-attachment-data";
11
24
  readonly ContentAttachmentType: "Communication.content-attachment-type";
12
25
  readonly ContentAttachmentTitle: "Communication.content-attachment-title";
26
+ readonly ContentAttachmentUrl: "Communication.content-attachment-url";
13
27
  readonly PartOf: "Communication.part-of";
14
28
  };
15
29
  export type CommunicationClaimKey = typeof CommunicationClaim[keyof typeof CommunicationClaim];