gdc-sdk-front-ts 0.5.1 → 0.6.0
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 +42 -3
- package/dist/discovery/DataspaceDiscoveryClient.d.ts +54 -0
- package/dist/discovery/DataspaceDiscoveryClient.js +85 -0
- package/dist/discovery/HttpDataspaceDiscoveryClient.d.ts +34 -0
- package/dist/discovery/HttpDataspaceDiscoveryClient.js +47 -0
- package/dist/discovery/index.d.ts +3 -0
- package/dist/discovery/index.js +4 -0
- package/dist/discovery/mappers.d.ts +29 -0
- package/dist/discovery/mappers.js +60 -0
- package/dist/discovery/types.d.ts +83 -0
- package/dist/discovery/types.js +2 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/services.d.ts +0 -15
- package/dist/services.js +0 -23
- package/dist/types.d.ts +1 -12
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -22,11 +22,14 @@ If you are integrating this package for the first time, open these in order:
|
|
|
22
22
|
Real frontend/native setup, imports, `new ClientSDK(...)`,
|
|
23
23
|
`initializeCommunicationIdentity(...)`, provider discovery, and
|
|
24
24
|
`initializeSession(...)`.
|
|
25
|
-
2. [
|
|
25
|
+
2. [docs/DATASPACE_DISCOVERY_FRONTEND_TODO.md](./docs/DATASPACE_DISCOVERY_FRONTEND_TODO.md)
|
|
26
|
+
Frontend discovery guide for BFF-first provider/operator discovery, UI card
|
|
27
|
+
mapping, and copy/paste backend DTO consumption.
|
|
28
|
+
3. [gdc-sdk-core-ts/docs/SDK_FLOWS_101.md](https://github.com/Global-DataCare/gdc-sdk-core-ts/blob/main/docs/SDK_FLOWS_101.md)
|
|
26
29
|
Shared business-flow map by actor family.
|
|
27
|
-
|
|
30
|
+
4. [gdc-common-utils-ts/src/examples/frontend-session.ts](https://github.com/Global-DataCare/gdc-common-utils-ts/blob/main/src/examples/frontend-session.ts)
|
|
28
31
|
Shared profile/session payload source of truth.
|
|
29
|
-
|
|
32
|
+
5. [gdc-common-utils-ts/docs/LIFECYCLE_101.md](https://github.com/Global-DataCare/gdc-common-utils-ts/blob/main/docs/LIFECYCLE_101.md)
|
|
30
33
|
Canonical lifecycle semantics and reusable placeholders for UI and portal flows.
|
|
31
34
|
|
|
32
35
|
If you need the shortest path:
|
|
@@ -55,6 +58,42 @@ Open these tests when you want to see exact frontend calls and exact inputs:
|
|
|
55
58
|
Profile registry and persistence behavior.
|
|
56
59
|
- [tests/session-descriptor.test.mjs](tests/session-descriptor.test.mjs)
|
|
57
60
|
Session descriptor shaping for UI/runtime code.
|
|
61
|
+
- [tests/dataspace-discovery-client.test.mjs](tests/dataspace-discovery-client.test.mjs)
|
|
62
|
+
BFF-first dataspace discovery mapping, capability filtering, and DTO-to-card
|
|
63
|
+
behavior.
|
|
64
|
+
|
|
65
|
+
## Frontend Discovery Quick Map
|
|
66
|
+
|
|
67
|
+
Frontend apps should not crawl host catalogs directly by default.
|
|
68
|
+
|
|
69
|
+
Preferred model:
|
|
70
|
+
|
|
71
|
+
- backend/BFF resolves host discovery from `/.well-known/dspace-version`
|
|
72
|
+
- backend/BFF derives `/dsp/catalog/dcat.json`
|
|
73
|
+
- frontend consumes normalized DTOs and maps them into cards
|
|
74
|
+
|
|
75
|
+
Primary references:
|
|
76
|
+
|
|
77
|
+
- [docs/DATASPACE_DISCOVERY_FRONTEND_TODO.md](./docs/DATASPACE_DISCOVERY_FRONTEND_TODO.md)
|
|
78
|
+
- [tests/dataspace-discovery-client.test.mjs](tests/dataspace-discovery-client.test.mjs)
|
|
79
|
+
|
|
80
|
+
Copy/paste starting point:
|
|
81
|
+
|
|
82
|
+
```ts
|
|
83
|
+
import { HttpDataspaceDiscoveryClient } from 'gdc-sdk-front-ts';
|
|
84
|
+
import { ServiceCapabilityToken } from 'gdc-common-utils-ts/constants';
|
|
85
|
+
|
|
86
|
+
const discoveryClient = new HttpDataspaceDiscoveryClient({
|
|
87
|
+
endpointUrl: '/api/dataspace-discovery/providers',
|
|
88
|
+
});
|
|
89
|
+
|
|
90
|
+
const result = await discoveryClient.listPublishedProviders({
|
|
91
|
+
sector: 'animal-care',
|
|
92
|
+
jurisdiction: 'ES',
|
|
93
|
+
coverageScope: 'EU',
|
|
94
|
+
providerCapability: ServiceCapabilityToken.IndexProvider,
|
|
95
|
+
});
|
|
96
|
+
```
|
|
58
97
|
|
|
59
98
|
## Actor Split And UI Scope
|
|
60
99
|
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { type AppInfo } from 'gdc-sdk-core-ts';
|
|
2
|
+
import type { ListPublishedProvidersInput, ListPublishedProvidersResult } from './types.js';
|
|
3
|
+
type DiscoveryFetchResponse = Readonly<{
|
|
4
|
+
ok: boolean;
|
|
5
|
+
status: number;
|
|
6
|
+
json(): Promise<unknown>;
|
|
7
|
+
}>;
|
|
8
|
+
export type DiscoveryFetch = (input: string, init?: Readonly<{
|
|
9
|
+
method?: string;
|
|
10
|
+
headers?: Record<string, string>;
|
|
11
|
+
body?: string;
|
|
12
|
+
}>) => Promise<DiscoveryFetchResponse>;
|
|
13
|
+
export type HttpDataspaceDiscoveryClientOptions = Readonly<{
|
|
14
|
+
endpointUrl?: string;
|
|
15
|
+
fetcher?: DiscoveryFetch;
|
|
16
|
+
requestHeaders?: Record<string, string>;
|
|
17
|
+
appInfo?: AppInfo;
|
|
18
|
+
}>;
|
|
19
|
+
/**
|
|
20
|
+
* Frontend-facing discovery client.
|
|
21
|
+
*
|
|
22
|
+
* Default integration model:
|
|
23
|
+
* - browser/native app calls a portal or app backend
|
|
24
|
+
* - backend resolves dataspace discovery and returns normalized DTOs
|
|
25
|
+
*
|
|
26
|
+
* Optional direct-public-catalog mode can be layered later behind an adapter,
|
|
27
|
+
* but must not be treated as the default portal integration path.
|
|
28
|
+
*/
|
|
29
|
+
export interface DataspaceDiscoveryClient {
|
|
30
|
+
/**
|
|
31
|
+
* Lists publicly published provider offerings for a given sector and provider
|
|
32
|
+
* capability.
|
|
33
|
+
*/
|
|
34
|
+
listPublishedProviders(input: ListPublishedProvidersInput): Promise<ListPublishedProvidersResult>;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Concrete frontend discovery client that calls a backend/BFF endpoint and
|
|
38
|
+
* maps normalized provider/operator DTOs into UI cards.
|
|
39
|
+
*
|
|
40
|
+
* Default integration model:
|
|
41
|
+
* - browser/native app calls a portal or app backend
|
|
42
|
+
* - backend resolves dataspace discovery and returns normalized DTO matches
|
|
43
|
+
*
|
|
44
|
+
* Optional direct-public-catalog mode can be layered later behind a separate
|
|
45
|
+
* adapter, but must not replace the BFF-first default contract.
|
|
46
|
+
*/
|
|
47
|
+
export declare class HttpDataspaceDiscoveryClient implements DataspaceDiscoveryClient {
|
|
48
|
+
private readonly endpointUrl;
|
|
49
|
+
private readonly fetcher;
|
|
50
|
+
private readonly requestHeaders;
|
|
51
|
+
constructor(options?: HttpDataspaceDiscoveryClientOptions);
|
|
52
|
+
listPublishedProviders(input: ListPublishedProvidersInput): Promise<ListPublishedProvidersResult>;
|
|
53
|
+
}
|
|
54
|
+
export {};
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
// Copyright 2026 Antifraud Services Inc. under the Apache License, Version 2.0.
|
|
2
|
+
import { buildAppHeaders, resolveAppInfo } from 'gdc-sdk-core-ts';
|
|
3
|
+
import { filterPublishedProviderCardsByCapability, mapHostingOperatorMatchToCard, mapPublishedProviderMatchToCard, } from './mappers.js';
|
|
4
|
+
function defaultFetch(input, init) {
|
|
5
|
+
return fetch(input, init);
|
|
6
|
+
}
|
|
7
|
+
function normalizeResponseDto(body) {
|
|
8
|
+
if (!body || typeof body !== 'object') {
|
|
9
|
+
throw new Error('Invalid dataspace discovery response payload.');
|
|
10
|
+
}
|
|
11
|
+
const candidate = body;
|
|
12
|
+
return {
|
|
13
|
+
providers: Array.isArray(candidate.providers) ? candidate.providers : [],
|
|
14
|
+
hostingOperators: Array.isArray(candidate.hostingOperators) ? candidate.hostingOperators : undefined,
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
function dedupeHostingOperatorCards(cards) {
|
|
18
|
+
const seen = new Set();
|
|
19
|
+
const deduped = [];
|
|
20
|
+
for (const card of cards) {
|
|
21
|
+
const did = String(card.did || '').trim();
|
|
22
|
+
if (!did || seen.has(did))
|
|
23
|
+
continue;
|
|
24
|
+
seen.add(did);
|
|
25
|
+
deduped.push(card);
|
|
26
|
+
}
|
|
27
|
+
return deduped;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Concrete frontend discovery client that calls a backend/BFF endpoint and
|
|
31
|
+
* maps normalized provider/operator DTOs into UI cards.
|
|
32
|
+
*
|
|
33
|
+
* Default integration model:
|
|
34
|
+
* - browser/native app calls a portal or app backend
|
|
35
|
+
* - backend resolves dataspace discovery and returns normalized DTO matches
|
|
36
|
+
*
|
|
37
|
+
* Optional direct-public-catalog mode can be layered later behind a separate
|
|
38
|
+
* adapter, but must not replace the BFF-first default contract.
|
|
39
|
+
*/
|
|
40
|
+
export class HttpDataspaceDiscoveryClient {
|
|
41
|
+
constructor(options = {}) {
|
|
42
|
+
this.endpointUrl = String(options.endpointUrl || '/api/dataspace-discovery/providers').trim();
|
|
43
|
+
this.fetcher = options.fetcher || defaultFetch;
|
|
44
|
+
const appHeaders = options.appInfo
|
|
45
|
+
? buildAppHeaders(resolveAppInfo(options.appInfo))
|
|
46
|
+
: {};
|
|
47
|
+
this.requestHeaders = {
|
|
48
|
+
Accept: 'application/json',
|
|
49
|
+
'Content-Type': 'application/json',
|
|
50
|
+
...appHeaders,
|
|
51
|
+
...(options.requestHeaders || {}),
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
async listPublishedProviders(input) {
|
|
55
|
+
const response = await this.fetcher(this.endpointUrl, {
|
|
56
|
+
method: 'POST',
|
|
57
|
+
headers: this.requestHeaders,
|
|
58
|
+
body: JSON.stringify({
|
|
59
|
+
sector: input.sector,
|
|
60
|
+
providerCapability: input.providerCapability,
|
|
61
|
+
jurisdiction: input.jurisdiction,
|
|
62
|
+
coverageScope: input.coverageScope,
|
|
63
|
+
}),
|
|
64
|
+
});
|
|
65
|
+
if (!response.ok) {
|
|
66
|
+
throw new Error(`Failed to list dataspace discovery providers (${response.status}).`);
|
|
67
|
+
}
|
|
68
|
+
const body = normalizeResponseDto(await response.json());
|
|
69
|
+
const providers = filterPublishedProviderCardsByCapability(body.providers.map((match) => mapPublishedProviderMatchToCard(match)), input.providerCapability);
|
|
70
|
+
const hostingOperators = body.hostingOperators
|
|
71
|
+
? dedupeHostingOperatorCards(body.hostingOperators.map((match) => mapHostingOperatorMatchToCard(match)))
|
|
72
|
+
: dedupeHostingOperatorCards(body.providers
|
|
73
|
+
.filter((match) => match.hostingOperator)
|
|
74
|
+
.map((match) => mapHostingOperatorMatchToCard({
|
|
75
|
+
operatorDid: match.hostingOperatorDid || match.hostingOperator?.subjectId || '',
|
|
76
|
+
record: match.hostingOperator,
|
|
77
|
+
title: match.hostingOperatorTitle,
|
|
78
|
+
catalogUrl: match.record.catalogUrl,
|
|
79
|
+
})));
|
|
80
|
+
return {
|
|
81
|
+
providers,
|
|
82
|
+
hostingOperators: hostingOperators.length ? hostingOperators : undefined,
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { DataspaceDiscoveryClient } from './DataspaceDiscoveryClient.js';
|
|
2
|
+
import type { ListPublishedProvidersInput, ListPublishedProvidersResult } from './types.js';
|
|
3
|
+
type DiscoveryFetchResponse = Readonly<{
|
|
4
|
+
ok: boolean;
|
|
5
|
+
status: number;
|
|
6
|
+
json(): Promise<unknown>;
|
|
7
|
+
}>;
|
|
8
|
+
export type FrontendDiscoveryFetch = (input: string, init?: Readonly<{
|
|
9
|
+
method?: string;
|
|
10
|
+
headers?: Record<string, string>;
|
|
11
|
+
body?: string;
|
|
12
|
+
}>) => Promise<DiscoveryFetchResponse>;
|
|
13
|
+
export type HttpDataspaceDiscoveryClientOptions = Readonly<{
|
|
14
|
+
baseUrl: string;
|
|
15
|
+
fetcher?: FrontendDiscoveryFetch;
|
|
16
|
+
endpointPath?: string;
|
|
17
|
+
headers?: Record<string, string>;
|
|
18
|
+
}>;
|
|
19
|
+
/**
|
|
20
|
+
* HTTP/BFF-first frontend discovery client.
|
|
21
|
+
*/
|
|
22
|
+
export declare class HttpDataspaceDiscoveryClient implements DataspaceDiscoveryClient {
|
|
23
|
+
private readonly baseUrl;
|
|
24
|
+
private readonly fetcher;
|
|
25
|
+
private readonly endpointPath;
|
|
26
|
+
private readonly headers;
|
|
27
|
+
constructor(options: HttpDataspaceDiscoveryClientOptions);
|
|
28
|
+
/**
|
|
29
|
+
* Calls the configured backend/BFF endpoint and maps normalized discovery
|
|
30
|
+
* DTOs into UI-facing cards.
|
|
31
|
+
*/
|
|
32
|
+
listPublishedProviders(input: ListPublishedProvidersInput): Promise<ListPublishedProvidersResult>;
|
|
33
|
+
}
|
|
34
|
+
export {};
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
// Copyright 2026 Antifraud Services Inc. under the Apache License, Version 2.0.
|
|
2
|
+
import { mapHostingOperatorRecordToCard, mapPublishedProviderRecordToCard } from './mappers.js';
|
|
3
|
+
function defaultFetch(input, init) {
|
|
4
|
+
return fetch(input, init);
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* HTTP/BFF-first frontend discovery client.
|
|
8
|
+
*/
|
|
9
|
+
export class HttpDataspaceDiscoveryClient {
|
|
10
|
+
constructor(options) {
|
|
11
|
+
this.baseUrl = new URL(options.baseUrl.endsWith('/') ? options.baseUrl : `${options.baseUrl}/`);
|
|
12
|
+
this.fetcher = options.fetcher || defaultFetch;
|
|
13
|
+
this.endpointPath = options.endpointPath || '/api/dataspace-discovery/providers';
|
|
14
|
+
this.headers = { ...(options.headers || {}) };
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Calls the configured backend/BFF endpoint and maps normalized discovery
|
|
18
|
+
* DTOs into UI-facing cards.
|
|
19
|
+
*/
|
|
20
|
+
async listPublishedProviders(input) {
|
|
21
|
+
const response = await this.fetcher(new URL(this.endpointPath.replace(/^\//, ''), this.baseUrl).href, {
|
|
22
|
+
method: 'POST',
|
|
23
|
+
headers: {
|
|
24
|
+
'content-type': 'application/json',
|
|
25
|
+
...this.headers,
|
|
26
|
+
},
|
|
27
|
+
body: JSON.stringify(input),
|
|
28
|
+
});
|
|
29
|
+
if (!response.ok) {
|
|
30
|
+
throw new Error(`Failed to load dataspace discovery results (${response.status}).`);
|
|
31
|
+
}
|
|
32
|
+
const body = await response.json();
|
|
33
|
+
const providers = Array.isArray(body.providers)
|
|
34
|
+
? body.providers.map((record) => mapPublishedProviderRecordToCard(record))
|
|
35
|
+
: [];
|
|
36
|
+
const hostingOperators = Array.isArray(body.hostingOperators)
|
|
37
|
+
? body.hostingOperators.map((entry) => mapHostingOperatorRecordToCard(entry.record, {
|
|
38
|
+
catalogUrl: entry.catalogUrl,
|
|
39
|
+
title: entry.title,
|
|
40
|
+
}))
|
|
41
|
+
: [];
|
|
42
|
+
return {
|
|
43
|
+
providers,
|
|
44
|
+
...(hostingOperators.length ? { hostingOperators } : {}),
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { HostingOperatorSemanticRecord, PublishedProviderCatalogRecord } from 'gdc-common-utils-ts';
|
|
2
|
+
import type { HostingOperatorCard, HostingOperatorMatchDto, PublishedProviderCard, PublishedProviderMatchDto } from './types.js';
|
|
3
|
+
/**
|
|
4
|
+
* Maps a normalized hosting-operator semantic record to a compact UI card.
|
|
5
|
+
*/
|
|
6
|
+
export declare function mapHostingOperatorRecordToCard(record: HostingOperatorSemanticRecord, input?: {
|
|
7
|
+
catalogUrl?: string;
|
|
8
|
+
title?: string;
|
|
9
|
+
}): HostingOperatorCard;
|
|
10
|
+
/**
|
|
11
|
+
* Maps a published-provider catalog entry to a compact UI card.
|
|
12
|
+
*/
|
|
13
|
+
export declare function mapPublishedProviderRecordToCard(record: PublishedProviderCatalogRecord, input?: {
|
|
14
|
+
title?: string;
|
|
15
|
+
}): PublishedProviderCard;
|
|
16
|
+
/**
|
|
17
|
+
* Maps a normalized backend/BFF hosting-operator match DTO to a compact UI
|
|
18
|
+
* card.
|
|
19
|
+
*/
|
|
20
|
+
export declare function mapHostingOperatorMatchToCard(match: HostingOperatorMatchDto): HostingOperatorCard;
|
|
21
|
+
/**
|
|
22
|
+
* Maps a normalized backend/BFF published-provider match DTO to a compact UI
|
|
23
|
+
* card.
|
|
24
|
+
*/
|
|
25
|
+
export declare function mapPublishedProviderMatchToCard(match: PublishedProviderMatchDto): PublishedProviderCard;
|
|
26
|
+
/**
|
|
27
|
+
* Filters provider cards by the requested capability at the presentation layer.
|
|
28
|
+
*/
|
|
29
|
+
export declare function filterPublishedProviderCardsByCapability(cards: readonly PublishedProviderCard[], capability: string): PublishedProviderCard[];
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
// Copyright 2026 Antifraud Services Inc. under the Apache License, Version 2.0.
|
|
2
|
+
function titleFromDid(did) {
|
|
3
|
+
const normalized = String(did || '').trim();
|
|
4
|
+
if (!normalized)
|
|
5
|
+
return 'Unknown';
|
|
6
|
+
const suffix = normalized.split(':').pop() || normalized;
|
|
7
|
+
return suffix.replace(/[-_]+/g, ' ');
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Maps a normalized hosting-operator semantic record to a compact UI card.
|
|
11
|
+
*/
|
|
12
|
+
export function mapHostingOperatorRecordToCard(record, input = {}) {
|
|
13
|
+
return {
|
|
14
|
+
did: record.subjectId || '',
|
|
15
|
+
title: input.title || titleFromDid(record.subjectId || ''),
|
|
16
|
+
sectors: record.categories,
|
|
17
|
+
coverageLabel: record.areaServed.join(', ') || record.coverageScope,
|
|
18
|
+
catalogUrl: input.catalogUrl,
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Maps a published-provider catalog entry to a compact UI card.
|
|
23
|
+
*/
|
|
24
|
+
export function mapPublishedProviderRecordToCard(record, input = {}) {
|
|
25
|
+
return {
|
|
26
|
+
did: record.providerDid,
|
|
27
|
+
title: input.title || titleFromDid(record.providerDid),
|
|
28
|
+
sector: record.category,
|
|
29
|
+
capability: record.serviceType,
|
|
30
|
+
coverageLabel: record.areaServed,
|
|
31
|
+
endpointUrl: record.endpointUrl,
|
|
32
|
+
catalogUrl: record.catalogUrl,
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Maps a normalized backend/BFF hosting-operator match DTO to a compact UI
|
|
37
|
+
* card.
|
|
38
|
+
*/
|
|
39
|
+
export function mapHostingOperatorMatchToCard(match) {
|
|
40
|
+
return mapHostingOperatorRecordToCard(match.record, {
|
|
41
|
+
catalogUrl: match.catalogUrl,
|
|
42
|
+
title: match.title,
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Maps a normalized backend/BFF published-provider match DTO to a compact UI
|
|
47
|
+
* card.
|
|
48
|
+
*/
|
|
49
|
+
export function mapPublishedProviderMatchToCard(match) {
|
|
50
|
+
return mapPublishedProviderRecordToCard(match.record, {
|
|
51
|
+
title: match.title,
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Filters provider cards by the requested capability at the presentation layer.
|
|
56
|
+
*/
|
|
57
|
+
export function filterPublishedProviderCardsByCapability(cards, capability) {
|
|
58
|
+
const normalized = String(capability || '').trim();
|
|
59
|
+
return cards.filter((card) => card.capability === normalized);
|
|
60
|
+
}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import type { DataspaceDiscoveryFilter } from 'gdc-common-utils-ts';
|
|
2
|
+
import type { HostingOperatorSemanticRecord, PublishedProviderCatalogRecord, TenantServiceSemanticRecord } from 'gdc-common-utils-ts';
|
|
3
|
+
/**
|
|
4
|
+
* Input used by frontend discovery clients to request published providers from
|
|
5
|
+
* a backend/BFF or, optionally, a public-catalog adapter.
|
|
6
|
+
*
|
|
7
|
+
* Default integration:
|
|
8
|
+
* - browser/native app calls its backend
|
|
9
|
+
* - backend resolves host DSP discovery and returns normalized DTOs
|
|
10
|
+
*/
|
|
11
|
+
export type ListPublishedProvidersInput = Omit<DataspaceDiscoveryFilter, 'capability' | 'requiredCapabilities'> & Readonly<{
|
|
12
|
+
providerCapability: string;
|
|
13
|
+
}>;
|
|
14
|
+
/**
|
|
15
|
+
* Normalized hosting-operator match DTO returned by a backend/BFF discovery
|
|
16
|
+
* endpoint.
|
|
17
|
+
*
|
|
18
|
+
* `catalogUrl` is optional because the frontend should not need to know
|
|
19
|
+
* whether the backend started from `/.well-known/dspace-version` and derived
|
|
20
|
+
* the DSP artifact or received a pre-normalized DTO from another layer.
|
|
21
|
+
*/
|
|
22
|
+
export type HostingOperatorMatchDto = Readonly<{
|
|
23
|
+
operatorDid: string;
|
|
24
|
+
record: HostingOperatorSemanticRecord;
|
|
25
|
+
matchedCapabilities?: readonly string[];
|
|
26
|
+
catalogUrl?: string;
|
|
27
|
+
title?: string;
|
|
28
|
+
}>;
|
|
29
|
+
/**
|
|
30
|
+
* Normalized published-provider match DTO returned by a backend/BFF discovery
|
|
31
|
+
* endpoint.
|
|
32
|
+
*
|
|
33
|
+
* `record.discoveryUrl` is the participant-scoped `/.well-known/dspace-version`
|
|
34
|
+
* entrypoint when the backend chooses to expose it.
|
|
35
|
+
*
|
|
36
|
+
* `record.catalogUrl` is the derived `/dsp/catalog/dcat.json` artifact.
|
|
37
|
+
*/
|
|
38
|
+
export type PublishedProviderMatchDto = Readonly<{
|
|
39
|
+
providerDid: string;
|
|
40
|
+
record: PublishedProviderCatalogRecord;
|
|
41
|
+
hostingOperator?: HostingOperatorSemanticRecord;
|
|
42
|
+
hostingOperatorDid?: string;
|
|
43
|
+
tenantSemanticRecord?: TenantServiceSemanticRecord;
|
|
44
|
+
title?: string;
|
|
45
|
+
hostingOperatorTitle?: string;
|
|
46
|
+
}>;
|
|
47
|
+
/**
|
|
48
|
+
* Compact UI-oriented hosting-operator summary.
|
|
49
|
+
*/
|
|
50
|
+
export type HostingOperatorCard = Readonly<{
|
|
51
|
+
did: string;
|
|
52
|
+
title: string;
|
|
53
|
+
sectors: string[];
|
|
54
|
+
coverageLabel?: string;
|
|
55
|
+
catalogUrl?: string;
|
|
56
|
+
}>;
|
|
57
|
+
/**
|
|
58
|
+
* Compact UI-oriented provider summary.
|
|
59
|
+
*/
|
|
60
|
+
export type PublishedProviderCard = Readonly<{
|
|
61
|
+
did: string;
|
|
62
|
+
title: string;
|
|
63
|
+
sector: string;
|
|
64
|
+
capability: string;
|
|
65
|
+
coverageLabel?: string;
|
|
66
|
+
endpointUrl?: string;
|
|
67
|
+
catalogUrl?: string;
|
|
68
|
+
}>;
|
|
69
|
+
/**
|
|
70
|
+
* Frontend-facing result shape for published provider discovery.
|
|
71
|
+
*/
|
|
72
|
+
export type ListPublishedProvidersResult = Readonly<{
|
|
73
|
+
providers: PublishedProviderCard[];
|
|
74
|
+
hostingOperators?: HostingOperatorCard[];
|
|
75
|
+
}>;
|
|
76
|
+
/**
|
|
77
|
+
* Backend/BFF discovery payload consumed by the frontend HTTP discovery
|
|
78
|
+
* client before mapping into UI cards.
|
|
79
|
+
*/
|
|
80
|
+
export type ListPublishedProvidersResponseDto = Readonly<{
|
|
81
|
+
providers: readonly PublishedProviderMatchDto[];
|
|
82
|
+
hostingOperators?: readonly HostingOperatorMatchDto[];
|
|
83
|
+
}>;
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
package/dist/services.d.ts
CHANGED
|
@@ -1,12 +1,4 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @fileoverview Frontend-only service facades.
|
|
3
|
-
*
|
|
4
|
-
* @architecture 101
|
|
5
|
-
* Keep this layer free from GW routing/crypto concerns. Product apps should call
|
|
6
|
-
* their portal/BFF here and map responses into shared DTOs.
|
|
7
|
-
*/
|
|
8
1
|
import type { DeviceAppType, DeviceUserClass } from 'gdc-common-utils-ts/constants';
|
|
9
|
-
import type { FrontRelatedProfileSearchResult } from './types.js';
|
|
10
2
|
export declare class CommonAuthService {
|
|
11
3
|
activateDevice(_licenseCode: string, _providerDid: string, _idToken: string): Promise<{
|
|
12
4
|
thid: string;
|
|
@@ -168,13 +160,6 @@ export declare class IndividualService {
|
|
|
168
160
|
}): Promise<{
|
|
169
161
|
thid: string;
|
|
170
162
|
}>;
|
|
171
|
-
/**
|
|
172
|
-
* Placeholder frontend-facing related-profile query surface.
|
|
173
|
-
*
|
|
174
|
-
* Product integrations are expected to call a portal/BFF endpoint such as
|
|
175
|
-
* `GET /api/personal/related-profiles` and map the response to this shared DTO.
|
|
176
|
-
*/
|
|
177
|
-
listRelatedProfiles(actorIdentifier: string): Promise<FrontRelatedProfileSearchResult>;
|
|
178
163
|
}
|
|
179
164
|
export declare class PhysicianService {
|
|
180
165
|
}
|
package/dist/services.js
CHANGED
|
@@ -1,12 +1,4 @@
|
|
|
1
1
|
// Copyright 2026 Antifraud Services Inc. under the Apache License, Version 2.0.
|
|
2
|
-
/**
|
|
3
|
-
* @fileoverview Frontend-only service facades.
|
|
4
|
-
*
|
|
5
|
-
* @architecture 101
|
|
6
|
-
* Keep this layer free from GW routing/crypto concerns. Product apps should call
|
|
7
|
-
* their portal/BFF here and map responses into shared DTOs.
|
|
8
|
-
*/
|
|
9
|
-
import { RELATED_PROFILE_SEARCH_PARAM_ACTOR_IDENTIFIER } from 'gdc-sdk-core-ts';
|
|
10
2
|
function requireNonEmptyText(value, fieldName) {
|
|
11
3
|
const normalized = String(value ?? '').trim();
|
|
12
4
|
if (!normalized) {
|
|
@@ -79,21 +71,6 @@ export class IndividualService {
|
|
|
79
71
|
async getLatestIps(_subject, _providerDid, _requiredScope, _idToken, _date) {
|
|
80
72
|
return { thid: `thid-${Date.now()}` };
|
|
81
73
|
}
|
|
82
|
-
/**
|
|
83
|
-
* Placeholder frontend-facing related-profile query surface.
|
|
84
|
-
*
|
|
85
|
-
* Product integrations are expected to call a portal/BFF endpoint such as
|
|
86
|
-
* `GET /api/personal/related-profiles` and map the response to this shared DTO.
|
|
87
|
-
*/
|
|
88
|
-
async listRelatedProfiles(actorIdentifier) {
|
|
89
|
-
requireNonEmptyText(actorIdentifier, `listRelatedProfiles ${RELATED_PROFILE_SEARCH_PARAM_ACTOR_IDENTIFIER}`);
|
|
90
|
-
const data = [];
|
|
91
|
-
return {
|
|
92
|
-
actorIdentifier,
|
|
93
|
-
total: data.length,
|
|
94
|
-
data,
|
|
95
|
-
};
|
|
96
|
-
}
|
|
97
74
|
}
|
|
98
75
|
export class PhysicianService {
|
|
99
76
|
}
|
package/dist/types.d.ts
CHANGED
|
@@ -1,10 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
* @fileoverview Frontend SDK shared type aliases.
|
|
3
|
-
*
|
|
4
|
-
* @architecture 101
|
|
5
|
-
* Re-export runtime-neutral contracts instead of duplicating DTO definitions.
|
|
6
|
-
*/
|
|
7
|
-
import type { IApiConfig, INetwork, BundleSearchQuery, CommunicationInput, DateRange, RelatedProfileSearchInput, RelatedProfileSearchResult, RelatedProfileRole, RelatedProfileStatus, RelatedProfileSummary } from 'gdc-sdk-core-ts';
|
|
1
|
+
import type { IApiConfig, INetwork, BundleSearchQuery, CommunicationInput, DateRange } from 'gdc-sdk-core-ts';
|
|
8
2
|
export type { AppInfo, ResolvedAppInfo, InitializeSessionParams, Profile, ProfileRegistryEntry, VaultQueryCondition, VaultQuery, IVaultRepository, IApiConfig, INetwork, IVerifier } from 'gdc-sdk-core-ts';
|
|
9
3
|
export type SdkConfig = {
|
|
10
4
|
crypto?: unknown;
|
|
@@ -15,8 +9,3 @@ export type SdkConfig = {
|
|
|
15
9
|
export type FrontDateRange = DateRange;
|
|
16
10
|
export type FrontBundleSearchQuery = BundleSearchQuery;
|
|
17
11
|
export type FrontCommunicationInput = CommunicationInput;
|
|
18
|
-
export type FrontRelatedProfileStatus = RelatedProfileStatus;
|
|
19
|
-
export type FrontRelatedProfileRole = RelatedProfileRole;
|
|
20
|
-
export type FrontRelatedProfileSearchInput = RelatedProfileSearchInput;
|
|
21
|
-
export type FrontRelatedProfileSummary = RelatedProfileSummary;
|
|
22
|
-
export type FrontRelatedProfileSearchResult = RelatedProfileSearchResult;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "gdc-sdk-front-ts",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.0",
|
|
4
4
|
"description": "Next-generation frontend runtime package for the GDC SDK family",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"author": "Antifraud Services Inc.",
|
|
@@ -17,8 +17,8 @@
|
|
|
17
17
|
},
|
|
18
18
|
"dependencies": {
|
|
19
19
|
"@babel/runtime": "^7.28.4",
|
|
20
|
-
"gdc-common-utils-ts": "^1.
|
|
21
|
-
"gdc-sdk-core-ts": "^0.
|
|
20
|
+
"gdc-common-utils-ts": "^1.13.0",
|
|
21
|
+
"gdc-sdk-core-ts": "^0.6.0"
|
|
22
22
|
},
|
|
23
23
|
"devDependencies": {
|
|
24
24
|
"@types/node": "^20.14.10",
|