gdc-common-utils-ts 1.17.0 → 1.18.1

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 (34) hide show
  1. package/README.md +20 -1
  2. package/dist/claims/claims-helpers-communication.d.ts +2 -0
  3. package/dist/claims/claims-helpers-communication.js +6 -0
  4. package/dist/constants/service-capabilities.d.ts +66 -36
  5. package/dist/constants/service-capabilities.js +94 -43
  6. package/dist/examples/communication-attached-bundle-session.js +6 -2
  7. package/dist/examples/dataspace-discovery.js +9 -9
  8. package/dist/examples/organization-controller.js +3 -3
  9. package/dist/examples/shared.d.ts +5 -3
  10. package/dist/examples/shared.js +4 -2
  11. package/dist/models/identity-bootstrap.d.ts +2 -1
  12. package/dist/models/interoperable-claims/communication-claims.d.ts +2 -0
  13. package/dist/models/interoperable-claims/communication-claims.js +2 -0
  14. package/dist/models/issue.d.ts +49 -37
  15. package/dist/models/issue.js +82 -44
  16. package/dist/models/operation-outcome.d.ts +2 -2
  17. package/dist/utils/activation-request.js +8 -7
  18. package/dist/utils/bundle-reader.d.ts +53 -1
  19. package/dist/utils/bundle-reader.js +142 -7
  20. package/dist/utils/communication-attached-bundle-session.d.ts +14 -0
  21. package/dist/utils/communication-attached-bundle-session.js +100 -4
  22. package/dist/utils/communication-claim-helpers.d.ts +1 -17
  23. package/dist/utils/communication-claim-helpers.js +1 -57
  24. package/dist/utils/communication-fhir-r4.d.ts +2 -9
  25. package/dist/utils/dataspace-discovery-defaults.d.ts +1 -0
  26. package/dist/utils/dataspace-discovery-defaults.js +3 -2
  27. package/dist/utils/dataspace-discovery.d.ts +4 -4
  28. package/dist/utils/dataspace-discovery.js +11 -8
  29. package/dist/utils/dataspace-protocol.d.ts +9 -4
  30. package/dist/utils/dataspace-protocol.js +18 -5
  31. package/dist/utils/fhir-validator.d.ts +3 -2
  32. package/dist/utils/fhir-validator.js +10 -9
  33. package/dist/utils/format-converter.js +3 -2
  34. package/package.json +1 -1
package/README.md CHANGED
@@ -30,6 +30,24 @@ boundaries used in `gdc-common-utils-ts`.
30
30
  - `resource.meta.claims` is the canonical project-specific claims container and must be preserved across conversions/transports.
31
31
  - `resource.meta.claims` is not part of base FHIR; it is a claims-first extension carried by FHIR-like resources in GDC contracts.
32
32
 
33
+ ## 101 Test Convention
34
+
35
+ Every `101` test in this repo is expected to be a didactic executable tutorial,
36
+ not only a behavior check.
37
+
38
+ Required shape for `101` tests:
39
+
40
+ - start with a short `Teaching goal` comment block
41
+ - explain the main app/business flow, not only internal plumbing
42
+ - use explicit `Step 1.`, `Step 2.`, ... comments for the happy path
43
+ - make clear what the user/app already has, what is shown, what is edited,
44
+ what is saved, and what is reloaded
45
+ - if a low-level helper path is shown, mark it explicitly as an escape hatch
46
+ and not the primary `101` path
47
+
48
+ The goal is that a developer can read the test top-to-bottom as tutorial
49
+ material without needing chat history or private repo context.
50
+
33
51
  If you need the canonical explanation of how DIDComm envelope, batch body,
34
52
  entry types, FHIR-like resources, and `resource.meta.claims` fit together,
35
53
  read first:
@@ -213,13 +231,14 @@ import { HostNetworkTypes } from 'gdc-common-utils-ts/constants/network';
213
231
 
214
232
  const hostContext = {
215
233
  participantId: 'host',
234
+ hostCoverageScope: 'EU',
216
235
  jurisdiction: 'ES',
217
236
  version: 'v1',
218
237
  hostNetwork: HostNetworkTypes.Test,
219
238
  };
220
239
 
221
240
  const discoveryPath = buildGwDspaceVersionWellKnownPath(hostContext);
222
- const metadata = buildDspaceVersionMetadata('/host/cds-ES/v1/test/dsp');
241
+ const metadata = buildDspaceVersionMetadata('/host/cds-EU/v1/test/dsp');
223
242
  const catalogPath = buildGwCatalogArtifactPath(hostContext);
224
243
  const catalogUrl = deriveGwCatalogArtifactUrlFromDspaceVersion(
225
244
  `https://host.example.org${discoveryPath}`,
@@ -9,6 +9,8 @@ export declare function getCommunicationCategoryList(claims: CommunicationIntero
9
9
  export declare function setCommunicationCategory(claims: CommunicationInteroperableClaims, value: string | readonly string[]): CommunicationInteroperableClaims;
10
10
  export declare function addCommunicationCategoryList(claims: CommunicationInteroperableClaims, value: string | readonly string[]): CommunicationInteroperableClaims;
11
11
  export declare function removeCommunicationCategoryList(claims: CommunicationInteroperableClaims, value: string | readonly string[]): CommunicationInteroperableClaims;
12
+ export declare function getCommunicationTopic(claims: CommunicationInteroperableClaims): string;
13
+ export declare function setCommunicationTopic(claims: CommunicationInteroperableClaims, value: unknown): CommunicationInteroperableClaims;
12
14
  export declare function getCommunicationText(claims: CommunicationInteroperableClaims): string;
13
15
  export declare function setCommunicationText(claims: CommunicationInteroperableClaims, value: unknown): CommunicationInteroperableClaims;
14
16
  export declare function getCommunicationContentAttachmentData(claims: CommunicationInteroperableClaims): string;
@@ -37,6 +37,12 @@ export function addCommunicationCategoryList(claims, value) {
37
37
  export function removeCommunicationCategoryList(claims, value) {
38
38
  return removeClaimValues(claims, CommunicationClaim.Category, value);
39
39
  }
40
+ export function getCommunicationTopic(claims) {
41
+ return getCommunicationScalar(claims, CommunicationClaim.Topic);
42
+ }
43
+ export function setCommunicationTopic(claims, value) {
44
+ return setCommunicationScalar(claims, CommunicationClaim.Topic, value);
45
+ }
40
46
  export function getCommunicationText(claims) {
41
47
  return getCommunicationScalar(claims, CommunicationClaim.Text);
42
48
  }
@@ -1,63 +1,93 @@
1
1
  /**
2
- * Canonical capability families persisted through
2
+ * Canonical persisted capability values stored in
3
3
  * `org.schema.Service.serviceType`.
4
4
  */
5
- export declare const ServiceCapabilityFamily: {
6
- readonly Indexing: "indexing";
7
- readonly DigitalTwin: "digitaltwin";
5
+ export declare const ServiceCapability: {
6
+ readonly IndexReader: "organization/Composition.rs";
7
+ readonly IndexProvider: "organization/Composition.cruds";
8
+ readonly DigitalTwinReader: "organization/ResearchSubject.rs";
9
+ readonly DigitalTwinProvider: "organization/ResearchSubject.cruds";
8
10
  };
9
- export type ServiceCapabilityFamilyValue = typeof ServiceCapabilityFamily[keyof typeof ServiceCapabilityFamily];
11
+ export type ServiceCapabilityValue = typeof ServiceCapability[keyof typeof ServiceCapability];
10
12
  /**
11
- * Canonical capability tokens currently documented for tenant activation.
12
- *
13
- * The family prefix is the stable part of the contract. Suffixes such as
14
- * `.rs` and `.cruds` can evolve independently across runtimes.
13
+ * Canonical capability families derived from the persisted service capability
14
+ * values.
15
15
  */
16
- export declare const ServiceCapabilityToken: {
16
+ export declare const ServiceCapabilityKind: {
17
+ readonly Indexing: "organization/composition";
18
+ readonly DigitalTwin: "organization/researchsubject";
19
+ };
20
+ export type ServiceCapabilityKindValue = typeof ServiceCapabilityKind[keyof typeof ServiceCapabilityKind];
21
+ /**
22
+ * @deprecated Legacy serviceType values accepted for backward compatibility.
23
+ */
24
+ export declare const DeprecatedServiceCapabilityToken: {
17
25
  readonly IndexReader: "indexing.rs";
18
26
  readonly IndexProvider: "indexing.cruds";
19
27
  readonly DigitalTwinReader: "digitaltwin.rs";
20
28
  readonly DigitalTwinProvider: "digitaltwin.cruds";
29
+ };
30
+ export type DeprecatedServiceCapabilityTokenValue = typeof DeprecatedServiceCapabilityToken[keyof typeof DeprecatedServiceCapabilityToken];
31
+ /**
32
+ * @deprecated Prefer `ServiceCapability`.
33
+ *
34
+ * Kept as a compatibility alias for older callers that imported
35
+ * `ServiceCapabilityToken`.
36
+ */
37
+ export declare const ServiceCapabilityToken: {
38
+ readonly IndexReader: "organization/Composition.rs";
39
+ readonly IndexProvider: "organization/Composition.cruds";
40
+ readonly DigitalTwinReader: "organization/ResearchSubject.rs";
41
+ readonly DigitalTwinProvider: "organization/ResearchSubject.cruds";
21
42
  /**
22
43
  * @deprecated Prefer `IndexReader`.
23
44
  */
24
- readonly IndexingReadSearch: "indexing.rs";
45
+ readonly IndexingReadSearch: "organization/Composition.rs";
25
46
  /**
26
47
  * @deprecated Prefer `IndexProvider`.
27
48
  */
28
- readonly IndexingCruds: "indexing.cruds";
49
+ readonly IndexingCruds: "organization/Composition.cruds";
29
50
  /**
30
51
  * @deprecated Prefer `DigitalTwinReader`.
31
52
  */
32
- readonly DigitalTwinReadSearch: "digitaltwin.rs";
53
+ readonly DigitalTwinReadSearch: "organization/ResearchSubject.rs";
33
54
  /**
34
55
  * @deprecated Prefer `DigitalTwinProvider`.
35
56
  */
36
- readonly DigitalTwinCruds: "digitaltwin.cruds";
37
- };
38
- export type ServiceCapabilityTokenValue = typeof ServiceCapabilityToken[keyof typeof ServiceCapabilityToken];
39
- /**
40
- * SDK-facing capability names.
41
- *
42
- * These names are intentionally more explicit than the persisted claim tokens:
43
- * - `Provider` maps to write/manage capability (`*.cruds`)
44
- * - `Reader` maps to read/search capability (`*.rs`)
45
- */
46
- export declare const ServiceCapability: {
47
- readonly IndexProvider: "indexing.cruds";
48
- readonly IndexReader: "indexing.rs";
49
- readonly DigitalTwinProvider: "digitaltwin.cruds";
50
- readonly DigitalTwinReader: "digitaltwin.rs";
57
+ readonly DigitalTwinCruds: "organization/ResearchSubject.cruds";
51
58
  /**
52
- * @deprecated Prefer `IndexProvider`.
59
+ * @deprecated Prefer `ServiceCapability.IndexReader`.
60
+ * Legacy persisted value kept for compatibility while external payloads
61
+ * still emit `indexing.rs`.
53
62
  */
54
- readonly IndexingProvider: "indexing.cruds";
63
+ readonly LegacyIndexReader: "indexing.rs";
55
64
  /**
56
- * @deprecated Prefer `IndexReader`.
65
+ * @deprecated Prefer `ServiceCapability.IndexProvider`.
66
+ * Legacy persisted value kept for compatibility while external payloads
67
+ * still emit `indexing.cruds`.
68
+ */
69
+ readonly LegacyIndexProvider: "indexing.cruds";
70
+ /**
71
+ * @deprecated Prefer `ServiceCapability.DigitalTwinReader`.
72
+ * Legacy persisted value kept for compatibility while external payloads
73
+ * still emit `digitaltwin.rs`.
57
74
  */
58
- readonly IndexingReader: "indexing.rs";
75
+ readonly LegacyDigitalTwinReader: "digitaltwin.rs";
76
+ /**
77
+ * @deprecated Prefer `ServiceCapability.DigitalTwinProvider`.
78
+ * Legacy persisted value kept for compatibility while external payloads
79
+ * still emit `digitaltwin.cruds`.
80
+ */
81
+ readonly LegacyDigitalTwinProvider: "digitaltwin.cruds";
59
82
  };
60
- export type ServiceCapabilityValue = typeof ServiceCapability[keyof typeof ServiceCapability];
83
+ /**
84
+ * @deprecated Prefer `ServiceCapabilityValue`.
85
+ */
86
+ export type ServiceCapabilityTokenValue = typeof ServiceCapabilityToken[keyof typeof ServiceCapabilityToken];
87
+ /**
88
+ * Normalizes a service capability token into its canonical persisted form.
89
+ */
90
+ export declare function normalizeServiceCapability(value: string | undefined | null): string | undefined;
61
91
  /**
62
92
  * Parses the CSV stored in `org.schema.Service.serviceType`.
63
93
  */
@@ -67,14 +97,14 @@ export declare function parseServiceCapabilityTokens(value: unknown): string[];
67
97
  */
68
98
  export declare function serializeServiceCapabilityTokens(values: ReadonlyArray<string | undefined | null>): string | undefined;
69
99
  /**
70
- * Returns the capability family prefix from a token.
100
+ * Returns the capability family prefix from a persisted capability token.
71
101
  */
72
- export declare function getServiceCapabilityFamily(value: string | undefined): string | undefined;
102
+ export declare function getServiceCapabilityKind(value: string | undefined): string | undefined;
73
103
  /**
74
104
  * Checks whether the claim contains at least one capability from the requested
75
105
  * family.
76
106
  */
77
- export declare function hasServiceCapabilityFamily(value: unknown, family: ServiceCapabilityFamilyValue | string): boolean;
107
+ export declare function hasServiceCapabilityKind(value: unknown, family: ServiceCapabilityKindValue | string): boolean;
78
108
  /**
79
109
  * Returns whether a capability token denotes a discoverable provider/service
80
110
  * role rather than a reader-only role.
@@ -1,105 +1,156 @@
1
1
  // Copyright 2026 Antifraud Services Inc. under the Apache License, Version 2.0.
2
2
  // Always create JSDoc, do not use strings inline in keys nor values, use types instead, and reuse the data test examples.
3
3
  /**
4
- * Canonical capability families persisted through
4
+ * Canonical persisted capability values stored in
5
5
  * `org.schema.Service.serviceType`.
6
6
  */
7
- export const ServiceCapabilityFamily = {
8
- Indexing: 'indexing',
9
- DigitalTwin: 'digitaltwin',
7
+ export const ServiceCapability = {
8
+ IndexReader: 'organization/Composition.rs',
9
+ IndexProvider: 'organization/Composition.cruds',
10
+ DigitalTwinReader: 'organization/ResearchSubject.rs',
11
+ DigitalTwinProvider: 'organization/ResearchSubject.cruds',
10
12
  };
11
13
  /**
12
- * Canonical capability tokens currently documented for tenant activation.
13
- *
14
- * The family prefix is the stable part of the contract. Suffixes such as
15
- * `.rs` and `.cruds` can evolve independently across runtimes.
14
+ * Canonical capability families derived from the persisted service capability
15
+ * values.
16
16
  */
17
- export const ServiceCapabilityToken = {
17
+ export const ServiceCapabilityKind = {
18
+ Indexing: 'organization/composition',
19
+ DigitalTwin: 'organization/researchsubject',
20
+ };
21
+ /**
22
+ * @deprecated Legacy serviceType values accepted for backward compatibility.
23
+ */
24
+ export const DeprecatedServiceCapabilityToken = {
18
25
  IndexReader: 'indexing.rs',
19
26
  IndexProvider: 'indexing.cruds',
20
27
  DigitalTwinReader: 'digitaltwin.rs',
21
28
  DigitalTwinProvider: 'digitaltwin.cruds',
29
+ };
30
+ /**
31
+ * @deprecated Prefer `ServiceCapability`.
32
+ *
33
+ * Kept as a compatibility alias for older callers that imported
34
+ * `ServiceCapabilityToken`.
35
+ */
36
+ export const ServiceCapabilityToken = {
37
+ IndexReader: ServiceCapability.IndexReader,
38
+ IndexProvider: ServiceCapability.IndexProvider,
39
+ DigitalTwinReader: ServiceCapability.DigitalTwinReader,
40
+ DigitalTwinProvider: ServiceCapability.DigitalTwinProvider,
22
41
  /**
23
42
  * @deprecated Prefer `IndexReader`.
24
43
  */
25
- IndexingReadSearch: 'indexing.rs',
44
+ IndexingReadSearch: ServiceCapability.IndexReader,
26
45
  /**
27
46
  * @deprecated Prefer `IndexProvider`.
28
47
  */
29
- IndexingCruds: 'indexing.cruds',
48
+ IndexingCruds: ServiceCapability.IndexProvider,
30
49
  /**
31
50
  * @deprecated Prefer `DigitalTwinReader`.
32
51
  */
33
- DigitalTwinReadSearch: 'digitaltwin.rs',
52
+ DigitalTwinReadSearch: ServiceCapability.DigitalTwinReader,
34
53
  /**
35
54
  * @deprecated Prefer `DigitalTwinProvider`.
36
55
  */
37
- DigitalTwinCruds: 'digitaltwin.cruds',
38
- };
39
- /**
40
- * SDK-facing capability names.
41
- *
42
- * These names are intentionally more explicit than the persisted claim tokens:
43
- * - `Provider` maps to write/manage capability (`*.cruds`)
44
- * - `Reader` maps to read/search capability (`*.rs`)
45
- */
46
- export const ServiceCapability = {
47
- IndexProvider: ServiceCapabilityToken.IndexProvider,
48
- IndexReader: ServiceCapabilityToken.IndexReader,
49
- DigitalTwinProvider: ServiceCapabilityToken.DigitalTwinProvider,
50
- DigitalTwinReader: ServiceCapabilityToken.DigitalTwinReader,
56
+ DigitalTwinCruds: ServiceCapability.DigitalTwinProvider,
51
57
  /**
52
- * @deprecated Prefer `IndexProvider`.
58
+ * @deprecated Prefer `ServiceCapability.IndexReader`.
59
+ * Legacy persisted value kept for compatibility while external payloads
60
+ * still emit `indexing.rs`.
53
61
  */
54
- IndexingProvider: ServiceCapabilityToken.IndexProvider,
62
+ LegacyIndexReader: DeprecatedServiceCapabilityToken.IndexReader,
55
63
  /**
56
- * @deprecated Prefer `IndexReader`.
64
+ * @deprecated Prefer `ServiceCapability.IndexProvider`.
65
+ * Legacy persisted value kept for compatibility while external payloads
66
+ * still emit `indexing.cruds`.
67
+ */
68
+ LegacyIndexProvider: DeprecatedServiceCapabilityToken.IndexProvider,
69
+ /**
70
+ * @deprecated Prefer `ServiceCapability.DigitalTwinReader`.
71
+ * Legacy persisted value kept for compatibility while external payloads
72
+ * still emit `digitaltwin.rs`.
73
+ */
74
+ LegacyDigitalTwinReader: DeprecatedServiceCapabilityToken.DigitalTwinReader,
75
+ /**
76
+ * @deprecated Prefer `ServiceCapability.DigitalTwinProvider`.
77
+ * Legacy persisted value kept for compatibility while external payloads
78
+ * still emit `digitaltwin.cruds`.
57
79
  */
58
- IndexingReader: ServiceCapabilityToken.IndexReader,
80
+ LegacyDigitalTwinProvider: DeprecatedServiceCapabilityToken.DigitalTwinProvider,
59
81
  };
82
+ const CANONICAL_SERVICE_CAPABILITY_BY_VALUE = new Map([
83
+ [String(ServiceCapability.IndexReader).toLowerCase(), ServiceCapability.IndexReader],
84
+ [String(ServiceCapability.IndexProvider).toLowerCase(), ServiceCapability.IndexProvider],
85
+ [String(ServiceCapability.DigitalTwinReader).toLowerCase(), ServiceCapability.DigitalTwinReader],
86
+ [String(ServiceCapability.DigitalTwinProvider).toLowerCase(), ServiceCapability.DigitalTwinProvider],
87
+ [String(DeprecatedServiceCapabilityToken.IndexReader).toLowerCase(), ServiceCapability.IndexReader],
88
+ [String(DeprecatedServiceCapabilityToken.IndexProvider).toLowerCase(), ServiceCapability.IndexProvider],
89
+ [String(DeprecatedServiceCapabilityToken.DigitalTwinReader).toLowerCase(), ServiceCapability.DigitalTwinReader],
90
+ [String(DeprecatedServiceCapabilityToken.DigitalTwinProvider).toLowerCase(), ServiceCapability.DigitalTwinProvider],
91
+ ]);
92
+ function splitServiceCapabilityToken(value) {
93
+ const lastDot = value.lastIndexOf('.');
94
+ if (lastDot < 0) {
95
+ return { family: value || undefined, suffix: undefined };
96
+ }
97
+ return {
98
+ family: value.slice(0, lastDot) || undefined,
99
+ suffix: value.slice(lastDot + 1) || undefined,
100
+ };
101
+ }
102
+ /**
103
+ * Normalizes a service capability token into its canonical persisted form.
104
+ */
105
+ export function normalizeServiceCapability(value) {
106
+ const normalized = String(value || '').trim();
107
+ if (!normalized)
108
+ return undefined;
109
+ return CANONICAL_SERVICE_CAPABILITY_BY_VALUE.get(normalized.toLowerCase()) || normalized;
110
+ }
60
111
  /**
61
112
  * Parses the CSV stored in `org.schema.Service.serviceType`.
62
113
  */
63
114
  export function parseServiceCapabilityTokens(value) {
64
115
  return Array.from(new Set(String(value || '')
65
116
  .split(',')
66
- .map((item) => item.trim())
67
- .filter(Boolean)));
117
+ .map((item) => normalizeServiceCapability(item))
118
+ .filter((item) => Boolean(item))));
68
119
  }
69
120
  /**
70
121
  * Serializes capability tokens into the canonical CSV claim format.
71
122
  */
72
123
  export function serializeServiceCapabilityTokens(values) {
73
124
  const normalized = Array.from(new Set(values
74
- .map((item) => String(item || '').trim())
75
- .filter(Boolean)));
125
+ .map((item) => normalizeServiceCapability(item))
126
+ .filter((item) => Boolean(item))));
76
127
  return normalized.length ? normalized.join(',') : undefined;
77
128
  }
78
129
  /**
79
- * Returns the capability family prefix from a token.
130
+ * Returns the capability family prefix from a persisted capability token.
80
131
  */
81
- export function getServiceCapabilityFamily(value) {
82
- const normalized = String(value || '').trim().toLowerCase();
132
+ export function getServiceCapabilityKind(value) {
133
+ const normalized = normalizeServiceCapability(value)?.toLowerCase();
83
134
  if (!normalized)
84
135
  return undefined;
85
- return normalized.split('.')[0] || undefined;
136
+ return splitServiceCapabilityToken(normalized).family;
86
137
  }
87
138
  /**
88
139
  * Checks whether the claim contains at least one capability from the requested
89
140
  * family.
90
141
  */
91
- export function hasServiceCapabilityFamily(value, family) {
142
+ export function hasServiceCapabilityKind(value, family) {
92
143
  const normalizedFamily = String(family || '').trim().toLowerCase();
93
144
  if (!normalizedFamily)
94
145
  return false;
95
- return parseServiceCapabilityTokens(value).some((item) => getServiceCapabilityFamily(item) === normalizedFamily);
146
+ return parseServiceCapabilityTokens(value).some((item) => getServiceCapabilityKind(item) === normalizedFamily);
96
147
  }
97
148
  /**
98
149
  * Returns whether a capability token denotes a discoverable provider/service
99
150
  * role rather than a reader-only role.
100
151
  */
101
152
  export function isProviderServiceCapability(value) {
102
- const normalized = String(value || '').trim().toLowerCase();
103
- return normalized === ServiceCapabilityToken.IndexProvider
104
- || normalized === ServiceCapabilityToken.DigitalTwinProvider;
153
+ const normalized = normalizeServiceCapability(value);
154
+ return normalized === ServiceCapability.IndexProvider
155
+ || normalized === ServiceCapability.DigitalTwinProvider;
105
156
  }
@@ -1,17 +1,18 @@
1
1
  // Copyright 2026 Conectate Soluciones y Aplicaciones SL under the Apache License, Version 2.0.
2
2
  // Always create JSDoc, do not use strings inline in keys nor values, use types instead, and reuse the data test examples.
3
- import { HealthcareBasicSections, HealthcareCanonicalSectionFamilies, HealthcareConsentPurposes, HealthcareCoreSections, } from '../constants/healthcare.js';
3
+ import { HealthcareBasicSections, HealthcareCanonicalSectionFamilies, HealthcareConsentPurposes, HealthcareCoreSections, HealthcareKindOfDocumentSections, } from '../constants/healthcare.js';
4
4
  import { ResourceTypesFhirR4 } from '../constants/fhir-resource-types.js';
5
5
  import { CommunicationCategoryCodes } from '../constants/communication.js';
6
6
  import { DataspaceSectors } from '../constants/sectors.js';
7
7
  import { MedicationStatementClaim } from '../models/interoperable-claims/medication-statement-claims.js';
8
8
  import { EXAMPLE_COMMUNICATION_IDENTIFIER, EXAMPLE_CONSENT_DATE, EXAMPLE_CONSENT_IDENTIFIER, EXAMPLE_CONSENT_PERIOD_END, EXAMPLE_CONSENT_PERIOD_START, EXAMPLE_CONSENT_PURPOSE_TREATMENT, EXAMPLE_CONSENT_PURPOSE_EMERGENCY_TREATMENT, EXAMPLE_EMAIL_PROFESSIONAL, EXAMPLE_HEALTHCARE_ACTOR_ROLE_GENERALIST_MEDICAL_PRACTITIONER, EXAMPLE_HEALTHCARE_ACTOR_ROLE_PHYSICIAN, EXAMPLE_HEALTHCARE_JURISDICTION, EXAMPLE_IPS_BUNDLE_NOTE_TEXT, EXAMPLE_MEDICATION_STATEMENT_IDENTIFIER, EXAMPLE_MEDICATION_STATEMENT_STATUS, EXAMPLE_MEDICATION_STATEMENT_TEXT, EXAMPLE_PROVIDER_ORGANIZATION_DID, EXAMPLE_SECONDARY_HEALTHCARE_JURISDICTION, EXAMPLE_SUBJECT_DID, } from './shared.js';
9
9
  import { CommunicationAttachedBundleSession, createConsentAccessEditor, } from '../utils/communication-attached-bundle-session.js';
10
- import { setCommunicationCategory, setCommunicationIdentifier, setCommunicationSubject, setCommunicationText, } from '../claims/claims-helpers-communication.js';
10
+ import { setCommunicationCategory, setCommunicationIdentifier, setCommunicationSubject, setCommunicationText, setCommunicationTopic, } from '../claims/claims-helpers-communication.js';
11
11
  import { setActorIdentifierList, setActorRoleList, setConsentDate, setConsentDecision, setConsentIdentifier, setConsentPeriodEnd, setConsentPeriodStart, setConsentSubject, setPurposeList, setSectionList, } from '../claims/claims-helpers-consent.js';
12
12
  import { setClaimValues } from '../claims/claim-list-helpers.js';
13
13
  import { ClaimConsent, ConsentDecisions } from '../models/consent-rule.js';
14
14
  import { exportConsentEntry, importPermissionTemplate, PermissionTemplateOperationCodes, PermissionTemplateTargetKinds, resolvePermissionTemplate, } from '../utils/permission-templates.js';
15
+ const CONSENT_BUNDLE_COMMUNICATION_TOPIC = HealthcareKindOfDocumentSections['LP173394-0'].attributeValue;
15
16
  /**
16
17
  * First developer use case:
17
18
  * - edit a Consent entry inside a Communication-attached Bundle
@@ -24,6 +25,7 @@ export function buildConsentEditingCommunicationSessionExample() {
24
25
  communicationClaims = setCommunicationIdentifier(communicationClaims, EXAMPLE_COMMUNICATION_IDENTIFIER);
25
26
  communicationClaims = setCommunicationSubject(communicationClaims, EXAMPLE_SUBJECT_DID);
26
27
  communicationClaims = setCommunicationCategory(communicationClaims, CommunicationCategoryCodes.Notification.attributeValue);
28
+ communicationClaims = setCommunicationTopic(communicationClaims, CONSENT_BUNDLE_COMMUNICATION_TOPIC);
27
29
  communicationClaims = setCommunicationText(communicationClaims, EXAMPLE_IPS_BUNDLE_NOTE_TEXT);
28
30
  const bundleEditor = new CommunicationAttachedBundleSession({
29
31
  communicationClaims,
@@ -95,6 +97,7 @@ export function buildConsentPermissionTemplateImportExportSessionExample() {
95
97
  communicationClaims = setCommunicationIdentifier(communicationClaims, EXAMPLE_COMMUNICATION_IDENTIFIER);
96
98
  communicationClaims = setCommunicationSubject(communicationClaims, EXAMPLE_SUBJECT_DID);
97
99
  communicationClaims = setCommunicationCategory(communicationClaims, CommunicationCategoryCodes.Notification.attributeValue);
100
+ communicationClaims = setCommunicationTopic(communicationClaims, CONSENT_BUNDLE_COMMUNICATION_TOPIC);
98
101
  communicationClaims = setCommunicationText(communicationClaims, EXAMPLE_IPS_BUNDLE_NOTE_TEXT);
99
102
  const templateDraft = {
100
103
  decision: ConsentDecisions.Permit,
@@ -172,6 +175,7 @@ export function buildSeparateConsentPermissionBundleExample() {
172
175
  communicationClaims = setCommunicationIdentifier(communicationClaims, EXAMPLE_COMMUNICATION_IDENTIFIER);
173
176
  communicationClaims = setCommunicationSubject(communicationClaims, EXAMPLE_SUBJECT_DID);
174
177
  communicationClaims = setCommunicationCategory(communicationClaims, CommunicationCategoryCodes.Notification.attributeValue);
178
+ communicationClaims = setCommunicationTopic(communicationClaims, CONSENT_BUNDLE_COMMUNICATION_TOPIC);
175
179
  communicationClaims = setCommunicationText(communicationClaims, EXAMPLE_IPS_BUNDLE_NOTE_TEXT);
176
180
  const physicianTemplate = resolvePermissionTemplate({
177
181
  sector: DataspaceSectors.HealthCare,
@@ -1,6 +1,6 @@
1
1
  // Copyright 2026 Antifraud Services Inc. under the Apache License, Version 2.0.
2
2
  import { ClaimsOrganizationSchemaorg, ClaimsServiceSchemaorg } from '../constants/schemaorg.js';
3
- import { serializeServiceCapabilityTokens, ServiceCapabilityToken } from '../constants/service-capabilities.js';
3
+ import { serializeServiceCapabilityTokens, ServiceCapability, } from '../constants/service-capabilities.js';
4
4
  import { EXAMPLE_HOSTING_OPERATOR_CATALOG_ARTIFACT_URL, EXAMPLE_HOSTING_OPERATOR_DSPACE_VERSION_URL, EXAMPLE_HOSTING_OPERATOR_DID, EXAMPLE_PROVIDER_PUBLISHED_ENDPOINT_URL, EXAMPLE_JURISDICTION, EXAMPLE_SECTOR, EXAMPLE_TENANT_SERVICE_DID, } from './shared.js';
5
5
  function firstOrCsv(values) {
6
6
  return values.length <= 1 ? (values[0] || '') : values.join(',');
@@ -16,8 +16,8 @@ function firstOrCsv(values) {
16
16
  */
17
17
  export function buildExampleHostingOperatorCredentialSubject(input = {}) {
18
18
  const serviceTypes = input.serviceTypes || [
19
- ServiceCapabilityToken.IndexProvider,
20
- ServiceCapabilityToken.DigitalTwinProvider,
19
+ ServiceCapability.IndexProvider,
20
+ ServiceCapability.DigitalTwinProvider,
21
21
  ];
22
22
  const categories = input.categories || [EXAMPLE_SECTOR];
23
23
  const areaServed = input.areaServed || ['EU', EXAMPLE_JURISDICTION];
@@ -39,7 +39,7 @@ export function buildExampleHostingOperatorCredentialSubject(input = {}) {
39
39
  * @returns Schema.org-shaped semantic subject with public service metadata.
40
40
  */
41
41
  export function buildExampleTenantServiceCredentialSubject(input = {}) {
42
- const serviceTypes = input.serviceTypes || [ServiceCapabilityToken.IndexProvider];
42
+ const serviceTypes = input.serviceTypes || [ServiceCapability.IndexProvider];
43
43
  const categories = input.categories || [EXAMPLE_SECTOR];
44
44
  const areaServed = input.areaServed || ['EU'];
45
45
  const addressCountry = input.addressCountry || EXAMPLE_JURISDICTION;
@@ -62,8 +62,8 @@ export function buildExampleTenantServiceCredentialSubject(input = {}) {
62
62
  */
63
63
  export function buildExampleHostingOperatorMetaClaims(input = {}) {
64
64
  const serviceTypes = input.serviceTypes || [
65
- ServiceCapabilityToken.IndexProvider,
66
- ServiceCapabilityToken.DigitalTwinProvider,
65
+ ServiceCapability.IndexProvider,
66
+ ServiceCapability.DigitalTwinProvider,
67
67
  ];
68
68
  const categories = input.categories || [EXAMPLE_SECTOR];
69
69
  const areaServed = input.areaServed || ['EU', EXAMPLE_JURISDICTION];
@@ -83,7 +83,7 @@ export function buildExampleHostingOperatorMetaClaims(input = {}) {
83
83
  * @returns Flat operational claims derived from the semantic subject.
84
84
  */
85
85
  export function buildExampleTenantServiceMetaClaims(input = {}) {
86
- const serviceTypes = input.serviceTypes || [ServiceCapabilityToken.IndexProvider];
86
+ const serviceTypes = input.serviceTypes || [ServiceCapability.IndexProvider];
87
87
  const categories = input.categories || [EXAMPLE_SECTOR];
88
88
  const areaServed = input.areaServed || ['EU'];
89
89
  const addressCountry = input.addressCountry || EXAMPLE_JURISDICTION;
@@ -107,12 +107,12 @@ export function buildExampleTenantServiceMetaClaims(input = {}) {
107
107
  * @returns Shared host-catalog provider entry.
108
108
  */
109
109
  export function buildExamplePublishedProviderCatalogRecord(input = {}) {
110
- const serviceTypes = input.serviceTypes || [ServiceCapabilityToken.IndexProvider];
110
+ const serviceTypes = input.serviceTypes || [ServiceCapability.IndexProvider];
111
111
  const categories = input.categories || [EXAMPLE_SECTOR];
112
112
  const areaServed = input.areaServed || ['EU'];
113
113
  return {
114
114
  providerDid: input.did || EXAMPLE_TENANT_SERVICE_DID,
115
- serviceType: serviceTypes[0] || ServiceCapabilityToken.IndexProvider,
115
+ serviceType: serviceTypes[0] || ServiceCapability.IndexProvider,
116
116
  category: categories[0] || EXAMPLE_SECTOR,
117
117
  areaServed: firstOrCsv(areaServed) || 'EU',
118
118
  endpointUrl: EXAMPLE_PROVIDER_PUBLISHED_ENDPOINT_URL,
@@ -1,7 +1,7 @@
1
1
  // Copyright 2026 Antifraud Services Inc. under the Apache License, Version 2.0.
2
2
  // Always create JSDoc, do not use strings inline in keys nor values, use types instead, and reuse the data test examples.
3
3
  import { ClaimsOrganizationSchemaorg, ClaimsPersonSchemaorg, ClaimsServiceSchemaorg, } from '../constants/schemaorg.js';
4
- import { ServiceCapabilityToken, serializeServiceCapabilityTokens, } from '../constants/service-capabilities.js';
4
+ import { serializeServiceCapabilityTokens, ServiceCapability, } from '../constants/service-capabilities.js';
5
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';
6
6
  /**
7
7
  * Examples for organization-controller and host-onboarding flows.
@@ -26,8 +26,8 @@ export const EXAMPLE_ACTIVATE_ORGANIZATION_FROM_ICA_PROOF_INPUT = {
26
26
  [ClaimsServiceSchemaorg.identifier]: EXAMPLE_SERVICE_PUBLIC_DID,
27
27
  [ClaimsServiceSchemaorg.url]: `https://operator.example.net/acme/cds-${String(EXAMPLE_JURISDICTION).toLowerCase()}/v1/${EXAMPLE_SECTOR}`,
28
28
  [ClaimsServiceSchemaorg.serviceType]: serializeServiceCapabilityTokens([
29
- ServiceCapabilityToken.IndexProvider,
30
- ServiceCapabilityToken.DigitalTwinReader,
29
+ ServiceCapability.IndexProvider,
30
+ ServiceCapability.DigitalTwinReader,
31
31
  ]),
32
32
  },
33
33
  };
@@ -10,6 +10,7 @@
10
10
  */
11
11
  export declare const EXAMPLE_TENANT_IDENTIFIER: "acme-id";
12
12
  export declare const EXAMPLE_JURISDICTION: "ES";
13
+ export declare const EXAMPLE_HOST_COVERAGE_SCOPE: "EU";
13
14
  export declare const EXAMPLE_NETWORK_TYPE: "test";
14
15
  export declare const EXAMPLE_ROUTE_VERSION: "v1";
15
16
  export declare const EXAMPLE_SECTOR: "health-care";
@@ -21,6 +22,7 @@ export declare const EXAMPLE_TENANT_ROUTE_CONTEXT: {
21
22
  readonly sector: "health-care";
22
23
  };
23
24
  export declare const EXAMPLE_HOST_ROUTE_CONTEXT: {
25
+ readonly hostCoverageScope: "EU";
24
26
  readonly jurisdiction: "ES";
25
27
  readonly sector: "test";
26
28
  };
@@ -41,10 +43,10 @@ export declare const EXAMPLE_HOSTING_OPERATOR_DID: "did:web:host.example.org";
41
43
  export declare const EXAMPLE_TENANT_SERVICE_DID: "did:web:provider.example.org";
42
44
  export declare const EXAMPLE_SECONDARY_TENANT_SERVICE_DID: "did:web:provider-b.example.org";
43
45
  export declare const EXAMPLE_INDEX_PROVIDER_SECTOR_DID_WEB: "did:web:provider.example.org:acme-id:cds-es:v1:health-care";
44
- export declare const EXAMPLE_HOSTING_OPERATOR_DSPACE_VERSION_URL: "https://host.example.org/host/cds-ES/v1/test/.well-known/dspace-version";
45
- export declare const EXAMPLE_HOSTING_OPERATOR_CATALOG_ARTIFACT_URL: "https://host.example.org/host/cds-ES/v1/test/dsp/catalog/dcat.json";
46
+ export declare const EXAMPLE_HOSTING_OPERATOR_DSPACE_VERSION_URL: "https://host.example.org/host/cds-EU/v1/test/.well-known/dspace-version";
47
+ export declare const EXAMPLE_HOSTING_OPERATOR_CATALOG_ARTIFACT_URL: "https://host.example.org/host/cds-EU/v1/test/dsp/catalog/dcat.json";
46
48
  /** @deprecated Use `EXAMPLE_HOSTING_OPERATOR_DSPACE_VERSION_URL`. */
47
- export declare const EXAMPLE_HOSTING_OPERATOR_CATALOG_URL: "https://host.example.org/host/cds-ES/v1/test/.well-known/dspace-version";
49
+ export declare const EXAMPLE_HOSTING_OPERATOR_CATALOG_URL: "https://host.example.org/host/cds-EU/v1/test/.well-known/dspace-version";
48
50
  export declare const EXAMPLE_PROVIDER_PUBLISHED_ENDPOINT_URL: "https://host.example.org/catalog/provider-a";
49
51
  export declare const EXAMPLE_PROVIDER_LEGAL_NAME: "ACME Health Provider";
50
52
  export declare const EXAMPLE_SECONDARY_PROVIDER_LEGAL_NAME: "Reader Only Provider";
@@ -18,6 +18,7 @@ import { medicationStatementFlatToFhirR4 } from '../utils/clinical-resource-conv
18
18
  */
19
19
  export const EXAMPLE_TENANT_IDENTIFIER = 'acme-id';
20
20
  export const EXAMPLE_JURISDICTION = 'ES';
21
+ export const EXAMPLE_HOST_COVERAGE_SCOPE = 'EU';
21
22
  export const EXAMPLE_NETWORK_TYPE = HostNetworkTypes.Test;
22
23
  export const EXAMPLE_ROUTE_VERSION = 'v1';
23
24
  export const EXAMPLE_SECTOR = DataspaceSectors.HealthCare;
@@ -29,6 +30,7 @@ export const EXAMPLE_TENANT_ROUTE_CONTEXT = {
29
30
  sector: EXAMPLE_SECTOR,
30
31
  };
31
32
  export const EXAMPLE_HOST_ROUTE_CONTEXT = {
33
+ hostCoverageScope: EXAMPLE_HOST_COVERAGE_SCOPE,
32
34
  jurisdiction: EXAMPLE_JURISDICTION,
33
35
  sector: HostNetworkTypes.Test,
34
36
  };
@@ -49,8 +51,8 @@ export const EXAMPLE_HOSTING_OPERATOR_DID = 'did:web:host.example.org';
49
51
  export const EXAMPLE_TENANT_SERVICE_DID = 'did:web:provider.example.org';
50
52
  export const EXAMPLE_SECONDARY_TENANT_SERVICE_DID = 'did:web:provider-b.example.org';
51
53
  export const EXAMPLE_INDEX_PROVIDER_SECTOR_DID_WEB = 'did:web:provider.example.org:acme-id:cds-es:v1:health-care';
52
- export const EXAMPLE_HOSTING_OPERATOR_DSPACE_VERSION_URL = `https://host.example.org/host/cds-ES/${EXAMPLE_ROUTE_VERSION}/${EXAMPLE_NETWORK_TYPE}/.well-known/dspace-version`;
53
- export const EXAMPLE_HOSTING_OPERATOR_CATALOG_ARTIFACT_URL = `https://host.example.org/host/cds-ES/${EXAMPLE_ROUTE_VERSION}/${EXAMPLE_NETWORK_TYPE}/dsp/catalog/dcat.json`;
54
+ export const EXAMPLE_HOSTING_OPERATOR_DSPACE_VERSION_URL = `https://host.example.org/host/cds-${EXAMPLE_HOST_COVERAGE_SCOPE}/${EXAMPLE_ROUTE_VERSION}/${EXAMPLE_NETWORK_TYPE}/.well-known/dspace-version`;
55
+ export const EXAMPLE_HOSTING_OPERATOR_CATALOG_ARTIFACT_URL = `https://host.example.org/host/cds-${EXAMPLE_HOST_COVERAGE_SCOPE}/${EXAMPLE_ROUTE_VERSION}/${EXAMPLE_NETWORK_TYPE}/dsp/catalog/dcat.json`;
54
56
  /** @deprecated Use `EXAMPLE_HOSTING_OPERATOR_DSPACE_VERSION_URL`. */
55
57
  export const EXAMPLE_HOSTING_OPERATOR_CATALOG_URL = EXAMPLE_HOSTING_OPERATOR_DSPACE_VERSION_URL;
56
58
  export const EXAMPLE_PROVIDER_PUBLISHED_ENDPOINT_URL = 'https://host.example.org/catalog/provider-a';
@@ -1,4 +1,5 @@
1
1
  import { PublicJwk } from '../interfaces/Cryptography.types';
2
+ import { type IssueSeverityAttentionCode } from './issue';
2
3
  import { JwkSet } from './jwk';
3
4
  /**
4
5
  * Public key binding for a human actor/controller identity.
@@ -83,7 +84,7 @@ export interface OrganizationActivationRequest extends ActivationProofInput {
83
84
  */
84
85
  export type IdentityBootstrapValidationIssue = {
85
86
  /** Validation severity. Errors fail the contract, warnings flag compatibility debt. */
86
- severity: 'error' | 'warning';
87
+ severity: IssueSeverityAttentionCode;
87
88
  /** Stable machine-readable issue identifier. */
88
89
  code: string;
89
90
  /** Human-readable description of the problem or compatibility note. */
@@ -25,6 +25,8 @@ export declare const CommunicationClaim: {
25
25
  readonly Sent: "Communication.sent";
26
26
  /** Human note text for the communication context. */
27
27
  readonly NoteText: "Communication.note-text";
28
+ /** Communication topic code (`system|code`). */
29
+ readonly Topic: "Communication.topic";
28
30
  /** Narrative text (short summary or body). */
29
31
  readonly Text: "Communication.text";
30
32
  /** Related resource references; CSV allowed. */
@@ -28,6 +28,8 @@ export const CommunicationClaim = {
28
28
  Sent: 'Communication.sent',
29
29
  /** Human note text for the communication context. */
30
30
  NoteText: 'Communication.note-text',
31
+ /** Communication topic code (`system|code`). */
32
+ Topic: 'Communication.topic',
31
33
  /** Narrative text (short summary or body). */
32
34
  Text: 'Communication.text',
33
35
  /** Related resource references; CSV allowed. */