vet-sdk-core-ts 0.4.35 → 0.4.37
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/dist/health-dcat.d.ts +8 -1
- package/dist/health-dcat.js +7 -2
- package/package.json +2 -2
package/dist/health-dcat.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { buildCatalogHostAdvertisement, buildHealthDcatFederationRequest, buildResearchStudyDatasetPublication, updateHealthDcatCatalogRecordStatus, type HealthDcatResource } from 'vet-data-utils-ts/health-dcat';
|
|
2
|
+
import { normalizeProvenanceR5FlatClaimsResource } from 'vet-data-utils-ts/provenance';
|
|
2
3
|
export type HealthDcatResourceType = HealthDcatResource['resourceType'];
|
|
3
4
|
export type HealthDcatBatchMethod = 'POST' | 'PUT';
|
|
4
5
|
/** Builds a claims-first HealthDCAT batch accepted by a product GW adapter. */
|
|
@@ -42,6 +43,10 @@ export type HealthDcatCatalogRequest = Readonly<{
|
|
|
42
43
|
} | {
|
|
43
44
|
operation: 'federate';
|
|
44
45
|
request: ReturnType<typeof buildHealthDcatFederationRequest>;
|
|
46
|
+
} | {
|
|
47
|
+
operation: 'publish-study-dataset';
|
|
48
|
+
provenance: ReturnType<typeof normalizeProvenanceR5FlatClaimsResource>;
|
|
49
|
+
envelope: ReturnType<typeof buildHealthDcatBatch>;
|
|
45
50
|
}>;
|
|
46
51
|
export type HealthDcatCatalogTransport = Readonly<{
|
|
47
52
|
execute(request: HealthDcatCatalogRequest): Promise<unknown>;
|
|
@@ -59,7 +64,9 @@ export declare class HealthDcatCatalogManager {
|
|
|
59
64
|
discoverHosts(): Promise<readonly ReturnType<typeof buildCatalogHostAdvertisement>[]>;
|
|
60
65
|
federate(input: Parameters<typeof buildHealthDcatFederationRequest>[0]): Promise<unknown>;
|
|
61
66
|
/** Publishes a study-derived Dataset and its editorial record atomically in one batch. */
|
|
62
|
-
publishResearchStudyDataset(input: Parameters<typeof buildResearchStudyDatasetPublication>[0]
|
|
67
|
+
publishResearchStudyDataset(input: Omit<Parameters<typeof buildResearchStudyDatasetPublication>[0], 'provenanceReference'> & Readonly<{
|
|
68
|
+
provenance: unknown;
|
|
69
|
+
}>): Promise<ReturnType<typeof buildResearchStudyDatasetPublication>>;
|
|
63
70
|
/** Updates only the CatalogRecord status; the ResearchStudy and Dataset remain intact. */
|
|
64
71
|
setResearchStudyDatasetPublicationStatus(input: Parameters<typeof updateHealthDcatCatalogRecordStatus>[0]): Promise<HealthDcatResource>;
|
|
65
72
|
}
|
package/dist/health-dcat.js
CHANGED
|
@@ -11,6 +11,7 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
|
|
|
11
11
|
};
|
|
12
12
|
var _HealthDcatCatalogManager_transport;
|
|
13
13
|
import { buildCatalogHostAdvertisement, buildHealthDcatFederationRequest, buildResearchStudyDatasetPublication, updateHealthDcatCatalogRecordStatus, normalizeHealthDcatResource, } from 'vet-data-utils-ts/health-dcat';
|
|
14
|
+
import { normalizeProvenanceR5FlatClaimsResource } from 'vet-data-utils-ts/provenance';
|
|
14
15
|
/** Builds a claims-first HealthDCAT batch accepted by a product GW adapter. */
|
|
15
16
|
export function buildHealthDcatBatch(resources, method = 'POST') {
|
|
16
17
|
return Object.freeze({ data: Object.freeze(resources.map(candidate => {
|
|
@@ -84,8 +85,12 @@ export class HealthDcatCatalogManager {
|
|
|
84
85
|
}
|
|
85
86
|
/** Publishes a study-derived Dataset and its editorial record atomically in one batch. */
|
|
86
87
|
async publishResearchStudyDataset(input) {
|
|
87
|
-
const
|
|
88
|
-
|
|
88
|
+
const provenance = normalizeProvenanceR5FlatClaimsResource(input.provenance);
|
|
89
|
+
const targets = provenance.meta.claims['Provenance.target'] ?? [];
|
|
90
|
+
if (!targets.includes(input.researchStudyIdentifier))
|
|
91
|
+
throw new TypeError('provenance_research_study_target_mismatch');
|
|
92
|
+
const publication = buildResearchStudyDatasetPublication({ ...input, provenanceReference: `Provenance/${provenance.id}` });
|
|
93
|
+
await __classPrivateFieldGet(this, _HealthDcatCatalogManager_transport, "f").execute(Object.freeze({ operation: 'publish-study-dataset', provenance, envelope: buildHealthDcatBatch([publication.dataset, publication.record]) }));
|
|
89
94
|
return publication;
|
|
90
95
|
}
|
|
91
96
|
/** Updates only the CatalogRecord status; the ResearchStudy and Dataset remain intact. */
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vet-sdk-core-ts",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.37",
|
|
4
4
|
"description": "Browser-safe VetChain core contracts and governed animal species identifiers",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"author": "Connecting Solution & Applications Ltd",
|
|
@@ -89,6 +89,6 @@
|
|
|
89
89
|
"@noble/hashes": "^2.2.0",
|
|
90
90
|
"@noble/post-quantum": "0.5.4",
|
|
91
91
|
"gdc-common-utils-ts": "2.9.10",
|
|
92
|
-
"vet-data-utils-ts": "0.5.
|
|
92
|
+
"vet-data-utils-ts": "0.5.28"
|
|
93
93
|
}
|
|
94
94
|
}
|