vet-sdk-core-ts 0.4.32 → 0.4.33
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.
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { type ClinicMarketplaceResult, type DirectoryFlatClaimsResource, type DirectoryResourceType } from 'vet-data-utils-ts/place-service-directory';
|
|
2
2
|
export type DirectoryBatchMethod = 'POST' | 'PUT';
|
|
3
|
-
/** Builds the claims-first Schema.org Place/Service batch accepted by GW VET. */
|
|
3
|
+
/** Builds the claims-first Schema.org Place/Service/Product batch accepted by GW VET. */
|
|
4
4
|
export declare function buildDirectoryBatch(resources: readonly unknown[], method?: DirectoryBatchMethod): Readonly<{
|
|
5
5
|
data: readonly Readonly<{
|
|
6
|
-
type: "Place-schema.org" | "Service-schema.org";
|
|
6
|
+
type: "Place-schema.org" | "Service-schema.org" | "Product-schema.org";
|
|
7
7
|
resource: Readonly<{
|
|
8
8
|
resourceType: DirectoryResourceType;
|
|
9
9
|
id: string;
|
|
@@ -13,11 +13,11 @@ export declare function buildDirectoryBatch(resources: readonly unknown[], metho
|
|
|
13
13
|
}>;
|
|
14
14
|
request: Readonly<{
|
|
15
15
|
method: DirectoryBatchMethod;
|
|
16
|
-
url: `Place/${string}` | `Service/${string}`;
|
|
16
|
+
url: `Place/${string}` | `Service/${string}` | `Product/${string}`;
|
|
17
17
|
}>;
|
|
18
18
|
}>[];
|
|
19
19
|
}>;
|
|
20
|
-
/** Builds one claims-first
|
|
20
|
+
/** Builds one claims-first directory `_search` envelope. Empty claims list the authorized directory. */
|
|
21
21
|
export declare function buildDirectorySearch(resourceType: DirectoryResourceType, claims?: Readonly<Record<string, unknown>>): Readonly<{
|
|
22
22
|
data: readonly Readonly<{
|
|
23
23
|
resource: Readonly<{
|
|
@@ -43,3 +43,24 @@ export declare function readClinicMarketplaceSearch(input: Readonly<{
|
|
|
43
43
|
radiusKm: number;
|
|
44
44
|
}>;
|
|
45
45
|
}>): readonly ClinicMarketplaceResult[];
|
|
46
|
+
export type OrganizationCatalogRequest = Readonly<{
|
|
47
|
+
operation: 'batch' | 'search';
|
|
48
|
+
resourceType?: DirectoryResourceType;
|
|
49
|
+
envelope: ReturnType<typeof buildDirectoryBatch> | ReturnType<typeof buildDirectorySearch>;
|
|
50
|
+
}>;
|
|
51
|
+
export type OrganizationCatalogTransport = Readonly<{
|
|
52
|
+
execute(request: OrganizationCatalogRequest): Promise<unknown>;
|
|
53
|
+
}>;
|
|
54
|
+
/**
|
|
55
|
+
* Reusable organization catalog manager for care Services and insurance or
|
|
56
|
+
* technology Products. The injected transport owns authentication and the GW
|
|
57
|
+
* route; this manager owns only claims-first envelopes and canonical readback.
|
|
58
|
+
*/
|
|
59
|
+
export declare class OrganizationCatalogManager {
|
|
60
|
+
#private;
|
|
61
|
+
constructor(transport: OrganizationCatalogTransport);
|
|
62
|
+
/** Publishes one or more organization offerings through a GW batch. */
|
|
63
|
+
publish(resources: readonly unknown[], method?: DirectoryBatchMethod): Promise<unknown>;
|
|
64
|
+
/** Searches the authorized catalog using governed flat Schema.org claims. */
|
|
65
|
+
search(resourceType: DirectoryResourceType, claims?: Readonly<Record<string, unknown>>): Promise<readonly DirectoryFlatClaimsResource[]>;
|
|
66
|
+
}
|
|
@@ -1,5 +1,17 @@
|
|
|
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 _OrganizationCatalogManager_transport;
|
|
1
13
|
import { normalizeDirectoryFlatClaimsResource, searchClinicMarketplace, } from 'vet-data-utils-ts/place-service-directory';
|
|
2
|
-
/** Builds the claims-first Schema.org Place/Service batch accepted by GW VET. */
|
|
14
|
+
/** Builds the claims-first Schema.org Place/Service/Product batch accepted by GW VET. */
|
|
3
15
|
export function buildDirectoryBatch(resources, method = 'POST') {
|
|
4
16
|
return Object.freeze({ data: Object.freeze(resources.map(candidate => {
|
|
5
17
|
const resource = normalizeDirectoryFlatClaimsResource(candidate);
|
|
@@ -10,7 +22,7 @@ export function buildDirectoryBatch(resources, method = 'POST') {
|
|
|
10
22
|
});
|
|
11
23
|
})) });
|
|
12
24
|
}
|
|
13
|
-
/** Builds one claims-first
|
|
25
|
+
/** Builds one claims-first directory `_search` envelope. Empty claims list the authorized directory. */
|
|
14
26
|
export function buildDirectorySearch(resourceType, claims = {}) {
|
|
15
27
|
const resource = normalizeDirectoryFlatClaimsResource({ resourceType, id: 'search', meta: { claims } });
|
|
16
28
|
return Object.freeze({ data: Object.freeze([Object.freeze({ resource })]) });
|
|
@@ -43,3 +55,35 @@ export function readClinicMarketplaceSearch(input) {
|
|
|
43
55
|
...(input.near ? { near: input.near } : {}),
|
|
44
56
|
});
|
|
45
57
|
}
|
|
58
|
+
/**
|
|
59
|
+
* Reusable organization catalog manager for care Services and insurance or
|
|
60
|
+
* technology Products. The injected transport owns authentication and the GW
|
|
61
|
+
* route; this manager owns only claims-first envelopes and canonical readback.
|
|
62
|
+
*/
|
|
63
|
+
export class OrganizationCatalogManager {
|
|
64
|
+
constructor(transport) {
|
|
65
|
+
_OrganizationCatalogManager_transport.set(this, void 0);
|
|
66
|
+
if (!transport || typeof transport.execute !== 'function')
|
|
67
|
+
throw new TypeError('organization_catalog_transport_invalid');
|
|
68
|
+
__classPrivateFieldSet(this, _OrganizationCatalogManager_transport, transport, "f");
|
|
69
|
+
}
|
|
70
|
+
/** Publishes one or more organization offerings through a GW batch. */
|
|
71
|
+
async publish(resources, method = 'POST') {
|
|
72
|
+
const envelope = buildDirectoryBatch(resources, method);
|
|
73
|
+
if (!envelope.data.length)
|
|
74
|
+
throw new TypeError('organization_catalog_resources_required');
|
|
75
|
+
return __classPrivateFieldGet(this, _OrganizationCatalogManager_transport, "f").execute(Object.freeze({ operation: 'batch', envelope }));
|
|
76
|
+
}
|
|
77
|
+
/** Searches the authorized catalog using governed flat Schema.org claims. */
|
|
78
|
+
async search(resourceType, claims = {}) {
|
|
79
|
+
const envelope = buildDirectorySearch(resourceType, claims);
|
|
80
|
+
const response = await __classPrivateFieldGet(this, _OrganizationCatalogManager_transport, "f").execute(Object.freeze({ operation: 'search', resourceType, envelope }));
|
|
81
|
+
return readDirectorySearch(responseBody(response), resourceType);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
_OrganizationCatalogManager_transport = new WeakMap();
|
|
85
|
+
function responseBody(value) {
|
|
86
|
+
if (value && typeof value === 'object' && 'body' in value)
|
|
87
|
+
return value.body;
|
|
88
|
+
return value;
|
|
89
|
+
}
|
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.33",
|
|
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",
|
|
@@ -85,6 +85,6 @@
|
|
|
85
85
|
"@noble/hashes": "^2.2.0",
|
|
86
86
|
"@noble/post-quantum": "0.5.4",
|
|
87
87
|
"gdc-common-utils-ts": "2.9.10",
|
|
88
|
-
"vet-data-utils-ts": "0.5.
|
|
88
|
+
"vet-data-utils-ts": "0.5.22"
|
|
89
89
|
}
|
|
90
90
|
}
|