gdc-common-utils-ts 2.3.2 → 2.3.3
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.
|
@@ -22,11 +22,12 @@ export function allergyIntoleranceFlatToFhirR4(claims) {
|
|
|
22
22
|
}
|
|
23
23
|
export function allergyIntoleranceFhirR4ToFlat(resource) {
|
|
24
24
|
const subject = resource.patient?.reference;
|
|
25
|
+
const code = resource.code;
|
|
25
26
|
return {
|
|
26
27
|
[AllergyIntoleranceClaim.Identifier]: resource.identifier?.[0]?.value,
|
|
27
28
|
[AllergyIntoleranceClaim.Subject]: subject,
|
|
28
29
|
[AllergyIntoleranceClaim.Patient]: subject,
|
|
29
|
-
[AllergyIntoleranceClaim.Code]: codingToValue(
|
|
30
|
+
[AllergyIntoleranceClaim.Code]: codingToValue(code?.coding?.[0]) || code?.text,
|
|
30
31
|
[AllergyIntoleranceClaim.ClinicalStatus]: resource.clinicalStatus?.coding?.[0]?.code,
|
|
31
32
|
[AllergyIntoleranceClaim.VerificationStatus]: resource.verificationStatus?.coding?.[0]?.code,
|
|
32
33
|
[AllergyIntoleranceClaim.Recorder]: resource.recorder?.reference,
|
|
@@ -14,10 +14,11 @@ export function conditionFlatToFhirR4(claims) {
|
|
|
14
14
|
};
|
|
15
15
|
}
|
|
16
16
|
export function conditionFhirR4ToFlat(resource) {
|
|
17
|
+
const code = resource.code;
|
|
17
18
|
return {
|
|
18
19
|
[ConditionClaim.Identifier]: resource.identifier?.[0]?.value,
|
|
19
20
|
[ConditionClaim.Subject]: resource.subject?.reference,
|
|
20
|
-
[ConditionClaim.Code]: codingToValue(
|
|
21
|
+
[ConditionClaim.Code]: codingToValue(code?.coding?.[0]) || code?.text,
|
|
21
22
|
[ConditionClaim.ClinicalStatus]: resource.clinicalStatus?.coding?.[0]?.code,
|
|
22
23
|
[ConditionClaim.VerificationStatus]: resource.verificationStatus?.coding?.[0]?.code,
|
|
23
24
|
};
|
|
@@ -57,7 +57,6 @@ export declare function buildGaiaXLegalPersonProjectionFromOrganizationCredentia
|
|
|
57
57
|
credentialId?: string;
|
|
58
58
|
issuerId: string;
|
|
59
59
|
legalRegistrationNumberCredentialId: string;
|
|
60
|
-
addressSubdivisionCode?: string;
|
|
61
60
|
addressCountryCode?: string;
|
|
62
61
|
validFrom: string;
|
|
63
62
|
}>): Readonly<{
|
|
@@ -67,14 +67,8 @@ export function resolveSchemaOrgOrganizationRegistrationIdentifier(credentialSub
|
|
|
67
67
|
* @see https://docs.gaia-x.eu/technical-committee/identity-credential-access-management/25.11/semantic_model/
|
|
68
68
|
*/
|
|
69
69
|
export function buildGaiaXLegalPersonCredentialDraft(input) {
|
|
70
|
-
const
|
|
71
|
-
const
|
|
72
|
-
if (!subdivision && !country) {
|
|
73
|
-
throw new Error('Missing organization ISO 3166-2 address subdivision or ISO 3166-1 country.');
|
|
74
|
-
}
|
|
75
|
-
const gaiaXAddress = subdivision
|
|
76
|
-
? { 'gx:countrySubdivisionCode': subdivision }
|
|
77
|
-
: { 'gx:countryCode': country };
|
|
70
|
+
const country = requiredClaim(input.claims, ClaimsOrganizationSchemaorg.addressCountry, 'organization ISO 3166-1 country code').toUpperCase();
|
|
71
|
+
const gaiaXAddress = { 'gx:countryCode': country };
|
|
78
72
|
const website = optionalClaim(input.claims, ClaimsOrganizationSchemaorg.url);
|
|
79
73
|
return {
|
|
80
74
|
'@context': [W3C_VC_V2_CONTEXT],
|
|
@@ -117,7 +111,6 @@ export function buildGaiaXLegalPersonProjectionFromOrganizationCredential(input)
|
|
|
117
111
|
const claims = {
|
|
118
112
|
[ClaimsOrganizationSchemaorg.legalName]: asString(subject.legalName || subject.name),
|
|
119
113
|
[ClaimsOrganizationSchemaorg.url]: asString(subject.url),
|
|
120
|
-
[ClaimsOrganizationSchemaorg.addressRegion]: input.addressSubdivisionCode || asString(address?.addressRegion),
|
|
121
114
|
[ClaimsOrganizationSchemaorg.addressCountry]: input.addressCountryCode || asString(address?.addressCountry),
|
|
122
115
|
[ClaimsOrganizationSchemaorg.identifierType]: registrationIdentifier.additionalType,
|
|
123
116
|
[ClaimsOrganizationSchemaorg.identifierValue]: registrationIdentifier.value,
|
|
@@ -148,6 +141,10 @@ export function buildGaiaXServiceOfferingCredentialDraft(input) {
|
|
|
148
141
|
const name = optionalClaim(input.claims, ClaimsServiceSchemaorg.name);
|
|
149
142
|
const description = optionalClaim(input.claims, ClaimsServiceSchemaorg.description);
|
|
150
143
|
const endpointUrl = optionalClaim(input.claims, ClaimsServiceSchemaorg.url);
|
|
144
|
+
const termsHash = requiredInput(input.termsAndConditionsHash, 'terms and conditions SHA-256 hash');
|
|
145
|
+
if (!/^[a-f0-9]{64}$/i.test(termsHash)) {
|
|
146
|
+
throw new Error('Gaia-X terms and conditions hash must be a 64-character SHA-256 hexadecimal digest of the published document bytes.');
|
|
147
|
+
}
|
|
151
148
|
return {
|
|
152
149
|
'@context': [W3C_VC_V2_CONTEXT],
|
|
153
150
|
type: ['VerifiableCredential', 'ServiceOffering'],
|
|
@@ -160,7 +157,7 @@ export function buildGaiaXServiceOfferingCredentialDraft(input) {
|
|
|
160
157
|
'gx:providedBy': { id: requiredInput(input.providedByCredentialId, 'providedBy credential id') },
|
|
161
158
|
'gx:serviceOfferingTermsAndConditions': [{
|
|
162
159
|
'gx:url': requiredInput(input.termsAndConditionsUrl, 'terms and conditions URL'),
|
|
163
|
-
'gx:hash':
|
|
160
|
+
'gx:hash': termsHash.toLowerCase(),
|
|
164
161
|
}],
|
|
165
162
|
...(name ? { 'gx:name': name } : {}),
|
|
166
163
|
...(description ? { 'gx:description': description } : {}),
|
package/dist/models/gaia-x.d.ts
CHANGED
|
@@ -94,13 +94,9 @@ export interface GaiaXLegalPersonCredentialSubject extends JsonObject {
|
|
|
94
94
|
id: string;
|
|
95
95
|
};
|
|
96
96
|
'gx:headquarterAddress': {
|
|
97
|
-
'gx:countrySubdivisionCode': string;
|
|
98
|
-
} | {
|
|
99
97
|
'gx:countryCode': string;
|
|
100
98
|
};
|
|
101
99
|
'gx:legalAddress': {
|
|
102
|
-
'gx:countrySubdivisionCode': string;
|
|
103
|
-
} | {
|
|
104
100
|
'gx:countryCode': string;
|
|
105
101
|
};
|
|
106
102
|
'gx:website'?: string;
|