vet-data-utils-ts 0.5.22 → 0.5.23
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.
|
@@ -152,6 +152,13 @@ export declare const OrganizationOfferingKinds: Readonly<{
|
|
|
152
152
|
readonly 'animal-care': "Service";
|
|
153
153
|
readonly 'animal-insurance': "Product";
|
|
154
154
|
}>;
|
|
155
|
+
/** Complete VetChain organization-sector presentation allowlist. */
|
|
156
|
+
export declare const OrganizationOfferingKindsBySector: Readonly<{
|
|
157
|
+
readonly 'animal-care': readonly ["Service"];
|
|
158
|
+
readonly 'animal-insurance': readonly ["Product"];
|
|
159
|
+
readonly 'animal-tech': readonly ["Service", "Product"];
|
|
160
|
+
readonly 'animal-research': readonly ["Service"];
|
|
161
|
+
}>;
|
|
155
162
|
/** Stable Eclipse Dataspace Protocol 2025-1 identifiers, including current editorial errata. */
|
|
156
163
|
export declare const DataspaceProtocol2025: Readonly<{
|
|
157
164
|
readonly release: "2025-1-err1";
|
|
@@ -318,7 +325,7 @@ export declare function buildOrganizationOfferCatalog(input: Readonly<{
|
|
|
318
325
|
id: string;
|
|
319
326
|
name: string;
|
|
320
327
|
organizationIdentifier: string;
|
|
321
|
-
sector: keyof typeof
|
|
328
|
+
sector: keyof typeof OrganizationOfferingKindsBySector;
|
|
322
329
|
offerings: readonly (DirectoryResource | DirectoryFlatClaimsResource)[];
|
|
323
330
|
}>): Readonly<{
|
|
324
331
|
'@context': "https://schema.org";
|
|
@@ -333,7 +340,7 @@ export declare function buildOrganizationOfferCatalog(input: Readonly<{
|
|
|
333
340
|
itemListElement: readonly Readonly<{
|
|
334
341
|
'@type': "Offer";
|
|
335
342
|
itemOffered: Readonly<{
|
|
336
|
-
'@type': "Service" | "Product";
|
|
343
|
+
'@type': "Place" | "Service" | "Product";
|
|
337
344
|
identifier: string;
|
|
338
345
|
name: string;
|
|
339
346
|
}>;
|
|
@@ -68,6 +68,13 @@ export const OrganizationOfferingKinds = Object.freeze({
|
|
|
68
68
|
'animal-care': 'Service',
|
|
69
69
|
'animal-insurance': 'Product',
|
|
70
70
|
});
|
|
71
|
+
/** Complete VetChain organization-sector presentation allowlist. */
|
|
72
|
+
export const OrganizationOfferingKindsBySector = Object.freeze({
|
|
73
|
+
'animal-care': Object.freeze(['Service']),
|
|
74
|
+
'animal-insurance': Object.freeze(['Product']),
|
|
75
|
+
'animal-tech': Object.freeze(['Service', 'Product']),
|
|
76
|
+
'animal-research': Object.freeze(['Service']),
|
|
77
|
+
});
|
|
71
78
|
/** Stable Eclipse Dataspace Protocol 2025-1 identifiers, including current editorial errata. */
|
|
72
79
|
export const DataspaceProtocol2025 = Object.freeze({
|
|
73
80
|
release: '2025-1-err1',
|
|
@@ -434,10 +441,10 @@ export function projectProductToFhirR5InsurancePlan(product) {
|
|
|
434
441
|
}
|
|
435
442
|
/** Builds the Schema.org JSON-LD OfferCatalog presented by one organization. */
|
|
436
443
|
export function buildOrganizationOfferCatalog(input) {
|
|
437
|
-
const
|
|
444
|
+
const allowedKinds = OrganizationOfferingKindsBySector[input.sector];
|
|
438
445
|
const organizationIdentifier = required(input.organizationIdentifier, 'organization_identifier_required');
|
|
439
446
|
const itemListElement = input.offerings.map(offering => {
|
|
440
|
-
if (offering.resourceType
|
|
447
|
+
if (!allowedKinds.includes(offering.resourceType))
|
|
441
448
|
throw new TypeError('organization_offering_kind_invalid');
|
|
442
449
|
const isService = offering.resourceType === 'Service';
|
|
443
450
|
const nameClaim = isService ? ClaimsDirectoryServiceSchemaorg.name : ClaimsProductSchemaorg.name;
|