vet-sdk-core-ts 0.4.33 → 0.4.35

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/README.md CHANGED
@@ -14,6 +14,18 @@ UHC SDK packages and must not import them.
14
14
  The SDK consumes governed browser-safe values from `vet-data-utils-ts` and
15
15
  owns gateway request construction. GW VET remains the policy authority.
16
16
 
17
+ `vet-sdk-core-ts/health-dcat` provides the neutral manager for tenant-owned
18
+ HealthDCAT metadata. It publishes and searches claims-first resources, asks an
19
+ ICA adapter for host catalogue capabilities, and sends explicit controller
20
+ federation requests. GW authentication, OpenID Federation trust resolution,
21
+ OpenID4VP verification and Dataspace Protocol exchange stay in injected
22
+ transports; the SDK neither exposes tenant inventories through ICA nor treats
23
+ the host as the tenant publisher.
24
+ Study publication writes the derived Dataset and its `CatalogRecord` together.
25
+ Withdrawal updates only that record to `archived`; it does not delete or alter
26
+ the ResearchStudy, eligibility/team Groups, ResearchSubjects or data-access
27
+ classification.
28
+
17
29
  ## Veterinary scheduling bundles
18
30
 
19
31
  The `vet-sdk-core-ts/scheduling` entrypoint extends the generic GW bundle
@@ -0,0 +1,65 @@
1
+ import { buildCatalogHostAdvertisement, buildHealthDcatFederationRequest, buildResearchStudyDatasetPublication, updateHealthDcatCatalogRecordStatus, type HealthDcatResource } from 'vet-data-utils-ts/health-dcat';
2
+ export type HealthDcatResourceType = HealthDcatResource['resourceType'];
3
+ export type HealthDcatBatchMethod = 'POST' | 'PUT';
4
+ /** Builds a claims-first HealthDCAT batch accepted by a product GW adapter. */
5
+ export declare function buildHealthDcatBatch(resources: readonly unknown[], method?: HealthDcatBatchMethod): Readonly<{
6
+ data: readonly Readonly<{
7
+ type: "Dataset-health-dcat" | "Catalog-health-dcat" | "CatalogRecord-health-dcat" | "Distribution-health-dcat" | "DataService-health-dcat";
8
+ resource: Readonly<{
9
+ resourceType: "Dataset" | "Catalog" | "CatalogRecord" | "Distribution" | "DataService";
10
+ id: string;
11
+ meta: Readonly<{
12
+ claims: Readonly<Record<string, string | number | boolean | readonly string[]>>;
13
+ }>;
14
+ }>;
15
+ request: Readonly<{
16
+ method: HealthDcatBatchMethod;
17
+ url: `Dataset/${string}` | `Catalog/${string}` | `CatalogRecord/${string}` | `Distribution/${string}` | `DataService/${string}`;
18
+ }>;
19
+ }>[];
20
+ }>;
21
+ /** Builds a governed flat-claim search without projecting JSON-LD in the client. */
22
+ export declare function buildHealthDcatSearch(resourceType: HealthDcatResourceType, claims?: Readonly<Record<string, unknown>>): Readonly<{
23
+ data: readonly Readonly<{
24
+ resource: Readonly<{
25
+ resourceType: "Dataset" | "Catalog" | "CatalogRecord" | "Distribution" | "DataService";
26
+ id: string;
27
+ meta: Readonly<{
28
+ claims: Readonly<Record<string, string | number | boolean | readonly string[]>>;
29
+ }>;
30
+ }>;
31
+ }>[];
32
+ }>;
33
+ export type HealthDcatCatalogRequest = Readonly<{
34
+ operation: 'batch';
35
+ envelope: ReturnType<typeof buildHealthDcatBatch>;
36
+ } | {
37
+ operation: 'search';
38
+ resourceType: HealthDcatResourceType;
39
+ envelope: ReturnType<typeof buildHealthDcatSearch>;
40
+ } | {
41
+ operation: 'discover-hosts';
42
+ } | {
43
+ operation: 'federate';
44
+ request: ReturnType<typeof buildHealthDcatFederationRequest>;
45
+ }>;
46
+ export type HealthDcatCatalogTransport = Readonly<{
47
+ execute(request: HealthDcatCatalogRequest): Promise<unknown>;
48
+ }>;
49
+ /**
50
+ * Neutral manager for tenant-owned HealthDCAT catalogues. Authentication,
51
+ * ICA resolution, OpenID Federation, OpenID4VP and DSP exchange remain in the
52
+ * injected host transport.
53
+ */
54
+ export declare class HealthDcatCatalogManager {
55
+ #private;
56
+ constructor(transport: HealthDcatCatalogTransport);
57
+ publish(resources: readonly unknown[], method?: HealthDcatBatchMethod): Promise<unknown>;
58
+ search(resourceType: HealthDcatResourceType, claims?: Readonly<Record<string, unknown>>): Promise<readonly HealthDcatResource[]>;
59
+ discoverHosts(): Promise<readonly ReturnType<typeof buildCatalogHostAdvertisement>[]>;
60
+ federate(input: Parameters<typeof buildHealthDcatFederationRequest>[0]): Promise<unknown>;
61
+ /** Publishes a study-derived Dataset and its editorial record atomically in one batch. */
62
+ publishResearchStudyDataset(input: Parameters<typeof buildResearchStudyDatasetPublication>[0]): Promise<ReturnType<typeof buildResearchStudyDatasetPublication>>;
63
+ /** Updates only the CatalogRecord status; the ResearchStudy and Dataset remain intact. */
64
+ setResearchStudyDatasetPublicationStatus(input: Parameters<typeof updateHealthDcatCatalogRecordStatus>[0]): Promise<HealthDcatResource>;
65
+ }
@@ -0,0 +1,103 @@
1
+ var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
2
+ if (kind === "m") throw new TypeError("Private method is not writable");
3
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
4
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
5
+ return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
6
+ };
7
+ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
8
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
9
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
10
+ return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
11
+ };
12
+ var _HealthDcatCatalogManager_transport;
13
+ import { buildCatalogHostAdvertisement, buildHealthDcatFederationRequest, buildResearchStudyDatasetPublication, updateHealthDcatCatalogRecordStatus, normalizeHealthDcatResource, } from 'vet-data-utils-ts/health-dcat';
14
+ /** Builds a claims-first HealthDCAT batch accepted by a product GW adapter. */
15
+ export function buildHealthDcatBatch(resources, method = 'POST') {
16
+ return Object.freeze({ data: Object.freeze(resources.map(candidate => {
17
+ const resource = normalizeHealthDcatResource(candidate);
18
+ return Object.freeze({
19
+ type: `${resource.resourceType}-health-dcat`,
20
+ resource,
21
+ request: Object.freeze({ method, url: `${resource.resourceType}/${resource.id}` }),
22
+ });
23
+ })) });
24
+ }
25
+ /** Builds a governed flat-claim search without projecting JSON-LD in the client. */
26
+ export function buildHealthDcatSearch(resourceType, claims = {}) {
27
+ const resource = normalizeHealthDcatResource({ resourceType, id: 'search', meta: { claims } });
28
+ return Object.freeze({ data: Object.freeze([Object.freeze({ resource })]) });
29
+ }
30
+ /**
31
+ * Neutral manager for tenant-owned HealthDCAT catalogues. Authentication,
32
+ * ICA resolution, OpenID Federation, OpenID4VP and DSP exchange remain in the
33
+ * injected host transport.
34
+ */
35
+ export class HealthDcatCatalogManager {
36
+ constructor(transport) {
37
+ _HealthDcatCatalogManager_transport.set(this, void 0);
38
+ if (!transport || typeof transport.execute !== 'function')
39
+ throw new TypeError('health_dcat_transport_invalid');
40
+ __classPrivateFieldSet(this, _HealthDcatCatalogManager_transport, transport, "f");
41
+ }
42
+ async publish(resources, method = 'POST') {
43
+ const envelope = buildHealthDcatBatch(resources, method);
44
+ if (!envelope.data.length)
45
+ throw new TypeError('health_dcat_resources_required');
46
+ return __classPrivateFieldGet(this, _HealthDcatCatalogManager_transport, "f").execute(Object.freeze({ operation: 'batch', envelope }));
47
+ }
48
+ async search(resourceType, claims = {}) {
49
+ const envelope = buildHealthDcatSearch(resourceType, claims);
50
+ const response = await __classPrivateFieldGet(this, _HealthDcatCatalogManager_transport, "f").execute(Object.freeze({ operation: 'search', resourceType, envelope }));
51
+ const body = responseBody(response);
52
+ if (!body || typeof body !== 'object' || !Array.isArray(body.data))
53
+ throw new TypeError('health_dcat_search_invalid');
54
+ return Object.freeze(body.data.map(entry => {
55
+ if (!entry || typeof entry !== 'object' || !('resource' in entry))
56
+ throw new TypeError('health_dcat_search_invalid');
57
+ const resource = normalizeHealthDcatResource(entry.resource);
58
+ if (resource.resourceType !== resourceType)
59
+ throw new TypeError('health_dcat_search_invalid');
60
+ return resource;
61
+ }));
62
+ }
63
+ async discoverHosts() {
64
+ const response = await __classPrivateFieldGet(this, _HealthDcatCatalogManager_transport, "f").execute(Object.freeze({ operation: 'discover-hosts' }));
65
+ const body = responseBody(response);
66
+ if (!body || typeof body !== 'object' || !Array.isArray(body.data))
67
+ throw new TypeError('catalog_host_discovery_invalid');
68
+ return Object.freeze(body.data.map(candidate => {
69
+ if (!candidate || typeof candidate !== 'object')
70
+ throw new TypeError('catalog_host_discovery_invalid');
71
+ const value = candidate;
72
+ if (value.catalogProtocol !== 'dataspace-protocol-2025-1')
73
+ throw new TypeError('catalog_host_discovery_invalid');
74
+ return buildCatalogHostAdvertisement({
75
+ hostIdentifier: String(value.hostIdentifier ?? ''),
76
+ catalogEndpoint: String(value.catalogEndpoint ?? ''),
77
+ tenantDiscovery: value.tenantDiscovery === 'public' ? 'public' : 'openid4vp',
78
+ });
79
+ }));
80
+ }
81
+ async federate(input) {
82
+ const request = buildHealthDcatFederationRequest(input);
83
+ return __classPrivateFieldGet(this, _HealthDcatCatalogManager_transport, "f").execute(Object.freeze({ operation: 'federate', request }));
84
+ }
85
+ /** Publishes a study-derived Dataset and its editorial record atomically in one batch. */
86
+ async publishResearchStudyDataset(input) {
87
+ const publication = buildResearchStudyDatasetPublication(input);
88
+ await __classPrivateFieldGet(this, _HealthDcatCatalogManager_transport, "f").execute(Object.freeze({ operation: 'batch', envelope: buildHealthDcatBatch([publication.dataset, publication.record]) }));
89
+ return publication;
90
+ }
91
+ /** Updates only the CatalogRecord status; the ResearchStudy and Dataset remain intact. */
92
+ async setResearchStudyDatasetPublicationStatus(input) {
93
+ const record = updateHealthDcatCatalogRecordStatus(input);
94
+ await __classPrivateFieldGet(this, _HealthDcatCatalogManager_transport, "f").execute(Object.freeze({ operation: 'batch', envelope: buildHealthDcatBatch([record], 'PUT') }));
95
+ return record;
96
+ }
97
+ }
98
+ _HealthDcatCatalogManager_transport = new WeakMap();
99
+ function responseBody(value) {
100
+ if (value && typeof value === 'object' && 'body' in value)
101
+ return value.body;
102
+ return value;
103
+ }
package/dist/index.d.ts CHANGED
@@ -7,6 +7,7 @@ export * from "./reusable-bff.js";
7
7
  export * from "./research-study.js";
8
8
  export * from "./payment.js";
9
9
  export * from "./place-service-directory.js";
10
+ export * from "./health-dcat.js";
10
11
  export * from "./health-card-issuance.js";
11
12
  export * from "./secure-clinic-channel.js";
12
13
  export * from "./scheduling.js";
package/dist/index.js CHANGED
@@ -7,6 +7,7 @@ export * from "./reusable-bff.js";
7
7
  export * from "./research-study.js";
8
8
  export * from "./payment.js";
9
9
  export * from "./place-service-directory.js";
10
+ export * from "./health-dcat.js";
10
11
  export * from "./health-card-issuance.js";
11
12
  export * from "./secure-clinic-channel.js";
12
13
  export * from "./scheduling.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vet-sdk-core-ts",
3
- "version": "0.4.33",
3
+ "version": "0.4.35",
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",
@@ -48,6 +48,10 @@
48
48
  "types": "./dist/place-service-directory.d.ts",
49
49
  "default": "./dist/place-service-directory.js"
50
50
  },
51
+ "./health-dcat": {
52
+ "types": "./dist/health-dcat.d.ts",
53
+ "default": "./dist/health-dcat.js"
54
+ },
51
55
  "./health-card-issuance": {
52
56
  "types": "./dist/health-card-issuance.d.ts",
53
57
  "default": "./dist/health-card-issuance.js"
@@ -85,6 +89,6 @@
85
89
  "@noble/hashes": "^2.2.0",
86
90
  "@noble/post-quantum": "0.5.4",
87
91
  "gdc-common-utils-ts": "2.9.10",
88
- "vet-data-utils-ts": "0.5.22"
92
+ "vet-data-utils-ts": "0.5.26"
89
93
  }
90
94
  }