gdc-common-utils-ts 1.11.0 → 1.13.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 +53 -2
- package/dist/constants/dataspace-protocol.d.ts +27 -0
- package/dist/constants/dataspace-protocol.js +27 -0
- package/dist/constants/eu-countries.d.ts +36 -0
- package/dist/constants/eu-countries.js +69 -0
- package/dist/constants/index.d.ts +2 -0
- package/dist/constants/index.js +2 -0
- package/dist/constants/network.d.ts +17 -5
- package/dist/constants/network.js +9 -5
- package/dist/constants/schemaorg.d.ts +1 -0
- package/dist/constants/schemaorg.js +1 -0
- package/dist/constants/service-capabilities.d.ts +5 -0
- package/dist/constants/service-capabilities.js +9 -0
- package/dist/examples/dataspace-discovery.d.ts +98 -0
- package/dist/examples/dataspace-discovery.js +141 -0
- package/dist/examples/index.d.ts +1 -0
- package/dist/examples/index.js +1 -0
- package/dist/examples/shared.d.ts +24 -1
- package/dist/examples/shared.js +21 -1
- package/dist/models/dataspace-discovery.d.ts +68 -0
- package/dist/models/dataspace-discovery.js +9 -0
- package/dist/models/dataspace-protocol.d.ts +14 -0
- package/dist/models/dataspace-protocol.js +2 -0
- package/dist/models/index.d.ts +2 -0
- package/dist/models/index.js +2 -0
- package/dist/utils/dataspace-discovery.d.ts +235 -0
- package/dist/utils/dataspace-discovery.js +482 -0
- package/dist/utils/dataspace-protocol.d.ts +66 -0
- package/dist/utils/dataspace-protocol.js +109 -0
- package/dist/utils/index.d.ts +2 -0
- package/dist/utils/index.js +2 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -86,9 +86,60 @@ import { JweObject, JwtCompactParts } from 'gdc-common-utils-ts/models';
|
|
|
86
86
|
|
|
87
87
|
## Cross-Repo Task Docs
|
|
88
88
|
|
|
89
|
+
- [docs/DATASPACE_DISCOVERY_ROADMAP.md](docs/DATASPACE_DISCOVERY_ROADMAP.md)
|
|
90
|
+
- cross-repo contract for dataspace discovery semantics, EU coverage
|
|
91
|
+
inference, shared DTOs, and parameterized examples
|
|
89
92
|
- [docs/consent-access-matrix-task.md](docs/consent-access-matrix-task.md)
|
|
90
93
|
- next-step design/task document for active consent aggregation, explicit deny precedence, controller views, permission-request communications, and SMART access evaluation
|
|
91
94
|
|
|
95
|
+
## Dataspace Protocol And Discovery
|
|
96
|
+
|
|
97
|
+
Use `gdc-common-utils-ts` as the shared source of truth for DSP route building,
|
|
98
|
+
`dspace-version` metadata, and normalized discovery DTOs.
|
|
99
|
+
|
|
100
|
+
Main entry points:
|
|
101
|
+
|
|
102
|
+
- [`src/utils/dataspace-protocol.ts`](src/utils/dataspace-protocol.ts)
|
|
103
|
+
- canonical GW CORE path builders for host-scoped and tenant-scoped DSP
|
|
104
|
+
routes
|
|
105
|
+
- [`src/utils/dataspace-discovery.ts`](src/utils/dataspace-discovery.ts)
|
|
106
|
+
- semantic extraction, provider filtering, default DTO builders, and the
|
|
107
|
+
copy/paste fetcher harness used by docs/tests
|
|
108
|
+
- [`src/examples/dataspace-discovery.ts`](src/examples/dataspace-discovery.ts)
|
|
109
|
+
- synthetic provider/operator examples that distinguish discovery URL from
|
|
110
|
+
derived catalog artifact URL
|
|
111
|
+
- [`__tests__/dataspace-protocol.test.ts`](__tests__/dataspace-protocol.test.ts)
|
|
112
|
+
- executable path and `dspace-version` examples
|
|
113
|
+
- [`__tests__/dataspace-discovery.test.ts`](__tests__/dataspace-discovery.test.ts)
|
|
114
|
+
- executable semantic extraction and filtering examples
|
|
115
|
+
|
|
116
|
+
Copy/paste example:
|
|
117
|
+
|
|
118
|
+
```ts
|
|
119
|
+
import {
|
|
120
|
+
buildDspaceVersionMetadata,
|
|
121
|
+
buildGwCatalogArtifactPath,
|
|
122
|
+
buildGwDspaceVersionWellKnownPath,
|
|
123
|
+
deriveGwCatalogArtifactUrlFromDspaceVersion,
|
|
124
|
+
} from 'gdc-common-utils-ts/utils/dataspace-protocol';
|
|
125
|
+
import { HostNetworkTypes } from 'gdc-common-utils-ts/constants/network';
|
|
126
|
+
|
|
127
|
+
const hostContext = {
|
|
128
|
+
participantId: 'host',
|
|
129
|
+
jurisdiction: 'ES',
|
|
130
|
+
version: 'v1',
|
|
131
|
+
hostNetwork: HostNetworkTypes.Test,
|
|
132
|
+
};
|
|
133
|
+
|
|
134
|
+
const discoveryPath = buildGwDspaceVersionWellKnownPath(hostContext);
|
|
135
|
+
const metadata = buildDspaceVersionMetadata('/host/cds-ES/v1/test/dsp');
|
|
136
|
+
const catalogPath = buildGwCatalogArtifactPath(hostContext);
|
|
137
|
+
const catalogUrl = deriveGwCatalogArtifactUrlFromDspaceVersion(
|
|
138
|
+
`https://host.example.org${discoveryPath}`,
|
|
139
|
+
metadata,
|
|
140
|
+
);
|
|
141
|
+
```
|
|
142
|
+
|
|
92
143
|
## API Index
|
|
93
144
|
|
|
94
145
|
The canonical API contract should live in JSDoc on exported code. The README acts as a navigable index.
|
|
@@ -113,8 +164,8 @@ The canonical API contract should live in JSDoc on exported code. The README act
|
|
|
113
164
|
- Reusable professional role/permission examples tying actor role, consent action, SMART scope, and expected FHIR resource types together.
|
|
114
165
|
- [`DeviceUserClasses`, `DeviceAppTypes`](src/constants/device.ts)
|
|
115
166
|
- Shared user-class and app/device-type constants used by licensing and SDK flows.
|
|
116
|
-
- [`
|
|
117
|
-
- Shared network/environment labels for
|
|
167
|
+
- [`HostNetworkTypes`](src/constants/network.ts)
|
|
168
|
+
- Shared network/environment labels for host discovery/bootstrap.
|
|
118
169
|
- [`SmartGatewayScopesFhirR4`](src/constants/smart.ts)
|
|
119
170
|
- Current CORE GW SMART scope literals such as `organization/Consent.cruds`.
|
|
120
171
|
- Treat these as optional elevated scopes. Do not add them to the first read-only tutorial by default.
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Canonical Dataspace Protocol version identifiers used by the current GW/SDK
|
|
3
|
+
* discovery flows.
|
|
4
|
+
*/
|
|
5
|
+
export declare const DataspaceProtocolVersions: Readonly<{
|
|
6
|
+
readonly Current: "2025-1";
|
|
7
|
+
}>;
|
|
8
|
+
/**
|
|
9
|
+
* Canonical well-known paths used by Dataspace Protocol discovery.
|
|
10
|
+
*/
|
|
11
|
+
export declare const DataspaceWellKnownPaths: Readonly<{
|
|
12
|
+
readonly VersionMetadata: "/.well-known/dspace-version";
|
|
13
|
+
}>;
|
|
14
|
+
/**
|
|
15
|
+
* Project-local GW CORE DSP binding paths.
|
|
16
|
+
*
|
|
17
|
+
* These preserve the current internal API structure while still ending in the
|
|
18
|
+
* DSP catalog route shapes.
|
|
19
|
+
*/
|
|
20
|
+
export declare const GwDataspaceBindingPaths: Readonly<{
|
|
21
|
+
readonly Base: "/dsp";
|
|
22
|
+
readonly CatalogCollectionSuffix: "/catalog";
|
|
23
|
+
readonly CatalogRequestSuffix: "/catalog/request";
|
|
24
|
+
readonly CatalogArtifactSuffix: "/catalog/dcat.json";
|
|
25
|
+
readonly CatalogDatasetsPrefix: "/catalog/datasets";
|
|
26
|
+
}>;
|
|
27
|
+
export type DataspaceProtocolVersionValue = typeof DataspaceProtocolVersions[keyof typeof DataspaceProtocolVersions];
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
// Copyright 2026 Antifraud Services Inc. under the Apache License, Version 2.0.
|
|
2
|
+
/**
|
|
3
|
+
* Canonical Dataspace Protocol version identifiers used by the current GW/SDK
|
|
4
|
+
* discovery flows.
|
|
5
|
+
*/
|
|
6
|
+
export const DataspaceProtocolVersions = Object.freeze({
|
|
7
|
+
Current: '2025-1',
|
|
8
|
+
});
|
|
9
|
+
/**
|
|
10
|
+
* Canonical well-known paths used by Dataspace Protocol discovery.
|
|
11
|
+
*/
|
|
12
|
+
export const DataspaceWellKnownPaths = Object.freeze({
|
|
13
|
+
VersionMetadata: '/.well-known/dspace-version',
|
|
14
|
+
});
|
|
15
|
+
/**
|
|
16
|
+
* Project-local GW CORE DSP binding paths.
|
|
17
|
+
*
|
|
18
|
+
* These preserve the current internal API structure while still ending in the
|
|
19
|
+
* DSP catalog route shapes.
|
|
20
|
+
*/
|
|
21
|
+
export const GwDataspaceBindingPaths = Object.freeze({
|
|
22
|
+
Base: '/dsp',
|
|
23
|
+
CatalogCollectionSuffix: '/catalog',
|
|
24
|
+
CatalogRequestSuffix: '/catalog/request',
|
|
25
|
+
CatalogArtifactSuffix: '/catalog/dcat.json',
|
|
26
|
+
CatalogDatasetsPrefix: '/catalog/datasets',
|
|
27
|
+
});
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ISO 3166-1 alpha-2 country codes that currently belong to the European Union.
|
|
3
|
+
*
|
|
4
|
+
* This list is intentionally kept in a runtime-neutral shared package because
|
|
5
|
+
* dataspace discovery may need to infer a broader coverage scope such as `EU`
|
|
6
|
+
* from the semantic country carried in a VC `credentialSubject`.
|
|
7
|
+
*/
|
|
8
|
+
export declare const EU_COUNTRY_CODES: readonly ["AT", "BE", "BG", "HR", "CY", "CZ", "DK", "EE", "FI", "FR", "DE", "GR", "HU", "IE", "IT", "LV", "LT", "LU", "MT", "NL", "PL", "PT", "RO", "SK", "SI", "ES", "SE"];
|
|
9
|
+
export type EuCountryCode = typeof EU_COUNTRY_CODES[number];
|
|
10
|
+
/**
|
|
11
|
+
* Normalizes a country code into canonical uppercase ISO-2 form.
|
|
12
|
+
*
|
|
13
|
+
* @param countryCode Country code from `credentialSubject.address.addressCountry`
|
|
14
|
+
* or the flattened operational projection.
|
|
15
|
+
* @returns Uppercase ISO-2 form or an empty string when the input is blank.
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* ```ts
|
|
19
|
+
* normalizeCountryCode('es');
|
|
20
|
+
* // 'ES'
|
|
21
|
+
* ```
|
|
22
|
+
*/
|
|
23
|
+
export declare function normalizeCountryCode(countryCode: string | undefined | null): string;
|
|
24
|
+
/**
|
|
25
|
+
* Checks whether the supplied country code belongs to the current EU member set.
|
|
26
|
+
*
|
|
27
|
+
* @param countryCode ISO-2 country code to evaluate.
|
|
28
|
+
* @returns `true` when the normalized code belongs to `EU_COUNTRY_CODES`.
|
|
29
|
+
*
|
|
30
|
+
* @example
|
|
31
|
+
* ```ts
|
|
32
|
+
* isEuCountryCode('ES');
|
|
33
|
+
* // true
|
|
34
|
+
* ```
|
|
35
|
+
*/
|
|
36
|
+
export declare function isEuCountryCode(countryCode: string | undefined | null): boolean;
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
// Copyright 2026 Antifraud Services Inc. under the Apache License, Version 2.0.
|
|
2
|
+
/**
|
|
3
|
+
* ISO 3166-1 alpha-2 country codes that currently belong to the European Union.
|
|
4
|
+
*
|
|
5
|
+
* This list is intentionally kept in a runtime-neutral shared package because
|
|
6
|
+
* dataspace discovery may need to infer a broader coverage scope such as `EU`
|
|
7
|
+
* from the semantic country carried in a VC `credentialSubject`.
|
|
8
|
+
*/
|
|
9
|
+
export const EU_COUNTRY_CODES = Object.freeze([
|
|
10
|
+
'AT',
|
|
11
|
+
'BE',
|
|
12
|
+
'BG',
|
|
13
|
+
'HR',
|
|
14
|
+
'CY',
|
|
15
|
+
'CZ',
|
|
16
|
+
'DK',
|
|
17
|
+
'EE',
|
|
18
|
+
'FI',
|
|
19
|
+
'FR',
|
|
20
|
+
'DE',
|
|
21
|
+
'GR',
|
|
22
|
+
'HU',
|
|
23
|
+
'IE',
|
|
24
|
+
'IT',
|
|
25
|
+
'LV',
|
|
26
|
+
'LT',
|
|
27
|
+
'LU',
|
|
28
|
+
'MT',
|
|
29
|
+
'NL',
|
|
30
|
+
'PL',
|
|
31
|
+
'PT',
|
|
32
|
+
'RO',
|
|
33
|
+
'SK',
|
|
34
|
+
'SI',
|
|
35
|
+
'ES',
|
|
36
|
+
'SE',
|
|
37
|
+
]);
|
|
38
|
+
/**
|
|
39
|
+
* Normalizes a country code into canonical uppercase ISO-2 form.
|
|
40
|
+
*
|
|
41
|
+
* @param countryCode Country code from `credentialSubject.address.addressCountry`
|
|
42
|
+
* or the flattened operational projection.
|
|
43
|
+
* @returns Uppercase ISO-2 form or an empty string when the input is blank.
|
|
44
|
+
*
|
|
45
|
+
* @example
|
|
46
|
+
* ```ts
|
|
47
|
+
* normalizeCountryCode('es');
|
|
48
|
+
* // 'ES'
|
|
49
|
+
* ```
|
|
50
|
+
*/
|
|
51
|
+
export function normalizeCountryCode(countryCode) {
|
|
52
|
+
return String(countryCode || '').trim().toUpperCase();
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Checks whether the supplied country code belongs to the current EU member set.
|
|
56
|
+
*
|
|
57
|
+
* @param countryCode ISO-2 country code to evaluate.
|
|
58
|
+
* @returns `true` when the normalized code belongs to `EU_COUNTRY_CODES`.
|
|
59
|
+
*
|
|
60
|
+
* @example
|
|
61
|
+
* ```ts
|
|
62
|
+
* isEuCountryCode('ES');
|
|
63
|
+
* // true
|
|
64
|
+
* ```
|
|
65
|
+
*/
|
|
66
|
+
export function isEuCountryCode(countryCode) {
|
|
67
|
+
const normalized = normalizeCountryCode(countryCode);
|
|
68
|
+
return normalized ? EU_COUNTRY_CODES.includes(normalized) : false;
|
|
69
|
+
}
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
export * from './actor-session';
|
|
2
2
|
export * from './communication';
|
|
3
3
|
export * from './cryptography';
|
|
4
|
+
export * from './dataspace-protocol';
|
|
4
5
|
export * from './device';
|
|
5
6
|
export * from './did-services';
|
|
7
|
+
export * from './eu-countries';
|
|
6
8
|
export * from './fhir-code-systems';
|
|
7
9
|
export * from './fhir-resource-types';
|
|
8
10
|
export * from './fhir-versions';
|
package/dist/constants/index.js
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
export * from './actor-session.js';
|
|
2
2
|
export * from './communication.js';
|
|
3
3
|
export * from './cryptography.js';
|
|
4
|
+
export * from './dataspace-protocol.js';
|
|
4
5
|
export * from './device.js';
|
|
5
6
|
export * from './did-services.js';
|
|
7
|
+
export * from './eu-countries.js';
|
|
6
8
|
export * from './fhir-code-systems.js';
|
|
7
9
|
export * from './fhir-resource-types.js';
|
|
8
10
|
export * from './fhir-versions.js';
|
|
@@ -1,13 +1,25 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Canonical network/environment labels used to identify
|
|
3
|
-
*
|
|
2
|
+
* Canonical network/environment labels used to identify host networks during
|
|
3
|
+
* discovery/bootstrap flows.
|
|
4
4
|
*
|
|
5
|
-
* These labels do not replace the
|
|
6
|
-
*
|
|
5
|
+
* These labels do not replace the business route `sector`. They describe the
|
|
6
|
+
* host environment itself.
|
|
7
|
+
*/
|
|
8
|
+
export declare const HostNetworkTypes: Readonly<{
|
|
9
|
+
readonly Test: "test";
|
|
10
|
+
readonly TestNetwork: "test-network";
|
|
11
|
+
readonly Network: "network";
|
|
12
|
+
}>;
|
|
13
|
+
export type HostNetworkType = typeof HostNetworkTypes[keyof typeof HostNetworkTypes];
|
|
14
|
+
/**
|
|
15
|
+
* @deprecated Use `HostNetworkTypes`.
|
|
7
16
|
*/
|
|
8
17
|
export declare const NodeOperatorNetworkTypes: Readonly<{
|
|
9
18
|
readonly Test: "test";
|
|
10
19
|
readonly TestNetwork: "test-network";
|
|
11
20
|
readonly Network: "network";
|
|
12
21
|
}>;
|
|
13
|
-
|
|
22
|
+
/**
|
|
23
|
+
* @deprecated Use `HostNetworkType`.
|
|
24
|
+
*/
|
|
25
|
+
export type NodeOperatorNetworkType = HostNetworkType;
|
|
@@ -1,13 +1,17 @@
|
|
|
1
1
|
// Copyright 2025 Antifraud Services Inc. under the Apache License, Version 2.0.
|
|
2
2
|
/**
|
|
3
|
-
* Canonical network/environment labels used to identify
|
|
4
|
-
*
|
|
3
|
+
* Canonical network/environment labels used to identify host networks during
|
|
4
|
+
* discovery/bootstrap flows.
|
|
5
5
|
*
|
|
6
|
-
* These labels do not replace the
|
|
7
|
-
*
|
|
6
|
+
* These labels do not replace the business route `sector`. They describe the
|
|
7
|
+
* host environment itself.
|
|
8
8
|
*/
|
|
9
|
-
export const
|
|
9
|
+
export const HostNetworkTypes = Object.freeze({
|
|
10
10
|
Test: 'test',
|
|
11
11
|
TestNetwork: 'test-network',
|
|
12
12
|
Network: 'network',
|
|
13
13
|
});
|
|
14
|
+
/**
|
|
15
|
+
* @deprecated Use `HostNetworkTypes`.
|
|
16
|
+
*/
|
|
17
|
+
export const NodeOperatorNetworkTypes = HostNetworkTypes;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { ParameterData } from "../models/params";
|
|
2
2
|
export declare enum ClaimsServiceSchemaorg {
|
|
3
|
+
areaServed = "org.schema.Service.areaServed",
|
|
3
4
|
category = "org.schema.Service.category",
|
|
4
5
|
identifier = "org.schema.Service.identifier",
|
|
5
6
|
serviceType = "org.schema.Service.serviceType",
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
// File: src/models/schemaorg.ts
|
|
3
3
|
export var ClaimsServiceSchemaorg;
|
|
4
4
|
(function (ClaimsServiceSchemaorg) {
|
|
5
|
+
ClaimsServiceSchemaorg["areaServed"] = "org.schema.Service.areaServed";
|
|
5
6
|
ClaimsServiceSchemaorg["category"] = "org.schema.Service.category";
|
|
6
7
|
ClaimsServiceSchemaorg["identifier"] = "org.schema.Service.identifier";
|
|
7
8
|
ClaimsServiceSchemaorg["serviceType"] = "org.schema.Service.serviceType";
|
|
@@ -75,3 +75,8 @@ export declare function getServiceCapabilityFamily(value: string | undefined): s
|
|
|
75
75
|
* family.
|
|
76
76
|
*/
|
|
77
77
|
export declare function hasServiceCapabilityFamily(value: unknown, family: ServiceCapabilityFamilyValue | string): boolean;
|
|
78
|
+
/**
|
|
79
|
+
* Returns whether a capability token denotes a discoverable provider/service
|
|
80
|
+
* role rather than a reader-only role.
|
|
81
|
+
*/
|
|
82
|
+
export declare function isProviderServiceCapability(value: string | undefined | null): boolean;
|
|
@@ -94,3 +94,12 @@ export function hasServiceCapabilityFamily(value, family) {
|
|
|
94
94
|
return false;
|
|
95
95
|
return parseServiceCapabilityTokens(value).some((item) => getServiceCapabilityFamily(item) === normalizedFamily);
|
|
96
96
|
}
|
|
97
|
+
/**
|
|
98
|
+
* Returns whether a capability token denotes a discoverable provider/service
|
|
99
|
+
* role rather than a reader-only role.
|
|
100
|
+
*/
|
|
101
|
+
export function isProviderServiceCapability(value) {
|
|
102
|
+
const normalized = String(value || '').trim().toLowerCase();
|
|
103
|
+
return normalized === ServiceCapabilityToken.IndexProvider
|
|
104
|
+
|| normalized === ServiceCapabilityToken.DigitalTwinProvider;
|
|
105
|
+
}
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import type { HostingOperatorDiscoveryCatalog, PublishedProviderCatalogRecord } from '../models/dataspace-discovery';
|
|
2
|
+
export type ExampleDataspaceCredentialSubjectInput = Readonly<{
|
|
3
|
+
did?: string;
|
|
4
|
+
serviceTypes?: readonly string[];
|
|
5
|
+
categories?: readonly string[];
|
|
6
|
+
areaServed?: readonly string[];
|
|
7
|
+
addressCountry?: string;
|
|
8
|
+
}>;
|
|
9
|
+
/**
|
|
10
|
+
* Builds a synthetic hosting-operator semantic `credentialSubject`.
|
|
11
|
+
*
|
|
12
|
+
* This example is parameterized on purpose: public docs/tests must not hardcode
|
|
13
|
+
* business identities when demonstrating dataspace discovery semantics.
|
|
14
|
+
*
|
|
15
|
+
* @param input Optional overrides for the synthetic subject.
|
|
16
|
+
* @returns Schema.org-shaped semantic subject with service metadata.
|
|
17
|
+
*/
|
|
18
|
+
export declare function buildExampleHostingOperatorCredentialSubject(input?: ExampleDataspaceCredentialSubjectInput): {
|
|
19
|
+
id: string;
|
|
20
|
+
serviceType: string;
|
|
21
|
+
category: string;
|
|
22
|
+
areaServed: {
|
|
23
|
+
'@type': string;
|
|
24
|
+
name: string;
|
|
25
|
+
}[];
|
|
26
|
+
address: {
|
|
27
|
+
addressCountry: string;
|
|
28
|
+
};
|
|
29
|
+
};
|
|
30
|
+
/**
|
|
31
|
+
* Builds a synthetic tenant-service semantic `credentialSubject`.
|
|
32
|
+
*
|
|
33
|
+
* @param input Optional overrides for the synthetic tenant subject.
|
|
34
|
+
* @returns Schema.org-shaped semantic subject with public service metadata.
|
|
35
|
+
*/
|
|
36
|
+
export declare function buildExampleTenantServiceCredentialSubject(input?: ExampleDataspaceCredentialSubjectInput): {
|
|
37
|
+
id: string;
|
|
38
|
+
serviceType: string;
|
|
39
|
+
category: string;
|
|
40
|
+
areaServed: {
|
|
41
|
+
'@type': string;
|
|
42
|
+
name: string;
|
|
43
|
+
}[];
|
|
44
|
+
address: {
|
|
45
|
+
addressCountry: string;
|
|
46
|
+
};
|
|
47
|
+
};
|
|
48
|
+
/**
|
|
49
|
+
* Builds the flattened `meta.claims` projection for a hosting-operator semantic
|
|
50
|
+
* subject.
|
|
51
|
+
*
|
|
52
|
+
* @param input Optional overrides for the synthetic projection.
|
|
53
|
+
* @returns Flat operational claims derived from the semantic subject.
|
|
54
|
+
*/
|
|
55
|
+
export declare function buildExampleHostingOperatorMetaClaims(input?: ExampleDataspaceCredentialSubjectInput): {
|
|
56
|
+
"org.schema.Service.serviceType": string | undefined;
|
|
57
|
+
"org.schema.Service.category": string;
|
|
58
|
+
"org.schema.Service.areaServed": string;
|
|
59
|
+
"org.schema.Organization.address.addressCountry": string;
|
|
60
|
+
};
|
|
61
|
+
/**
|
|
62
|
+
* Builds the flattened `meta.claims` projection for a tenant-service semantic
|
|
63
|
+
* subject.
|
|
64
|
+
*
|
|
65
|
+
* @param input Optional overrides for the synthetic projection.
|
|
66
|
+
* @returns Flat operational claims derived from the semantic subject.
|
|
67
|
+
*/
|
|
68
|
+
export declare function buildExampleTenantServiceMetaClaims(input?: ExampleDataspaceCredentialSubjectInput): {
|
|
69
|
+
"org.schema.Service.serviceType": string | undefined;
|
|
70
|
+
"org.schema.Service.category": string;
|
|
71
|
+
"org.schema.Service.areaServed": string;
|
|
72
|
+
"org.schema.Organization.address.addressCountry": string;
|
|
73
|
+
};
|
|
74
|
+
/**
|
|
75
|
+
* Builds a synthetic published-provider record as it would appear in a host
|
|
76
|
+
* service-autodiscovery catalog.
|
|
77
|
+
*
|
|
78
|
+
* URL rule:
|
|
79
|
+
* - `discoveryUrl` is the participant-scoped `/.well-known/dspace-version`
|
|
80
|
+
* entrypoint
|
|
81
|
+
* - `catalogUrl` is the derived `/dsp/catalog/dcat.json` artifact
|
|
82
|
+
*
|
|
83
|
+
* @param input Optional overrides for the synthetic provider publication.
|
|
84
|
+
* @returns Shared host-catalog provider entry.
|
|
85
|
+
*/
|
|
86
|
+
export declare function buildExamplePublishedProviderCatalogRecord(input?: ExampleDataspaceCredentialSubjectInput): PublishedProviderCatalogRecord;
|
|
87
|
+
/**
|
|
88
|
+
* Builds a synthetic host/operator service-autodiscovery catalog.
|
|
89
|
+
*
|
|
90
|
+
* URL rule:
|
|
91
|
+
* - `discoveryUrl` is the canonical entrypoint clients should fetch first
|
|
92
|
+
* - `catalogUrl` is the read-only DSP artifact derived from the advertised
|
|
93
|
+
* base path
|
|
94
|
+
*
|
|
95
|
+
* @param providers Optional published providers to include.
|
|
96
|
+
* @returns Shared catalog DTO for host-side public service autodiscovery.
|
|
97
|
+
*/
|
|
98
|
+
export declare function buildExampleHostingOperatorDiscoveryCatalog(providers?: ReadonlyArray<PublishedProviderCatalogRecord>): HostingOperatorDiscoveryCatalog;
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
// Copyright 2026 Antifraud Services Inc. under the Apache License, Version 2.0.
|
|
2
|
+
import { ClaimsOrganizationSchemaorg, ClaimsServiceSchemaorg } from '../constants/schemaorg.js';
|
|
3
|
+
import { serializeServiceCapabilityTokens, ServiceCapabilityToken } from '../constants/service-capabilities.js';
|
|
4
|
+
import { EXAMPLE_HOSTING_OPERATOR_CATALOG_ARTIFACT_URL, EXAMPLE_HOSTING_OPERATOR_DSPACE_VERSION_URL, EXAMPLE_HOSTING_OPERATOR_DID, EXAMPLE_PROVIDER_PUBLISHED_ENDPOINT_URL, EXAMPLE_JURISDICTION, EXAMPLE_SECTOR, EXAMPLE_TENANT_SERVICE_DID, } from './shared.js';
|
|
5
|
+
function firstOrCsv(values) {
|
|
6
|
+
return values.length <= 1 ? (values[0] || '') : values.join(',');
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Builds a synthetic hosting-operator semantic `credentialSubject`.
|
|
10
|
+
*
|
|
11
|
+
* This example is parameterized on purpose: public docs/tests must not hardcode
|
|
12
|
+
* business identities when demonstrating dataspace discovery semantics.
|
|
13
|
+
*
|
|
14
|
+
* @param input Optional overrides for the synthetic subject.
|
|
15
|
+
* @returns Schema.org-shaped semantic subject with service metadata.
|
|
16
|
+
*/
|
|
17
|
+
export function buildExampleHostingOperatorCredentialSubject(input = {}) {
|
|
18
|
+
const serviceTypes = input.serviceTypes || [
|
|
19
|
+
ServiceCapabilityToken.IndexProvider,
|
|
20
|
+
ServiceCapabilityToken.DigitalTwinProvider,
|
|
21
|
+
];
|
|
22
|
+
const categories = input.categories || [EXAMPLE_SECTOR];
|
|
23
|
+
const areaServed = input.areaServed || ['EU', EXAMPLE_JURISDICTION];
|
|
24
|
+
const addressCountry = input.addressCountry || EXAMPLE_JURISDICTION;
|
|
25
|
+
return {
|
|
26
|
+
id: input.did || 'did:web:host.example.org',
|
|
27
|
+
serviceType: firstOrCsv(serviceTypes),
|
|
28
|
+
category: firstOrCsv(categories),
|
|
29
|
+
areaServed: areaServed.map((name) => ({ '@type': 'AdministrativeArea', name })),
|
|
30
|
+
address: {
|
|
31
|
+
addressCountry,
|
|
32
|
+
},
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Builds a synthetic tenant-service semantic `credentialSubject`.
|
|
37
|
+
*
|
|
38
|
+
* @param input Optional overrides for the synthetic tenant subject.
|
|
39
|
+
* @returns Schema.org-shaped semantic subject with public service metadata.
|
|
40
|
+
*/
|
|
41
|
+
export function buildExampleTenantServiceCredentialSubject(input = {}) {
|
|
42
|
+
const serviceTypes = input.serviceTypes || [ServiceCapabilityToken.IndexProvider];
|
|
43
|
+
const categories = input.categories || [EXAMPLE_SECTOR];
|
|
44
|
+
const areaServed = input.areaServed || ['EU'];
|
|
45
|
+
const addressCountry = input.addressCountry || EXAMPLE_JURISDICTION;
|
|
46
|
+
return {
|
|
47
|
+
id: input.did || 'did:web:provider.example.org',
|
|
48
|
+
serviceType: firstOrCsv(serviceTypes),
|
|
49
|
+
category: firstOrCsv(categories),
|
|
50
|
+
areaServed: areaServed.map((name) => ({ '@type': 'AdministrativeArea', name })),
|
|
51
|
+
address: {
|
|
52
|
+
addressCountry,
|
|
53
|
+
},
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Builds the flattened `meta.claims` projection for a hosting-operator semantic
|
|
58
|
+
* subject.
|
|
59
|
+
*
|
|
60
|
+
* @param input Optional overrides for the synthetic projection.
|
|
61
|
+
* @returns Flat operational claims derived from the semantic subject.
|
|
62
|
+
*/
|
|
63
|
+
export function buildExampleHostingOperatorMetaClaims(input = {}) {
|
|
64
|
+
const serviceTypes = input.serviceTypes || [
|
|
65
|
+
ServiceCapabilityToken.IndexProvider,
|
|
66
|
+
ServiceCapabilityToken.DigitalTwinProvider,
|
|
67
|
+
];
|
|
68
|
+
const categories = input.categories || [EXAMPLE_SECTOR];
|
|
69
|
+
const areaServed = input.areaServed || ['EU', EXAMPLE_JURISDICTION];
|
|
70
|
+
const addressCountry = input.addressCountry || EXAMPLE_JURISDICTION;
|
|
71
|
+
return {
|
|
72
|
+
[ClaimsServiceSchemaorg.serviceType]: serializeServiceCapabilityTokens(serviceTypes),
|
|
73
|
+
[ClaimsServiceSchemaorg.category]: firstOrCsv(categories),
|
|
74
|
+
[ClaimsServiceSchemaorg.areaServed]: firstOrCsv(areaServed),
|
|
75
|
+
[ClaimsOrganizationSchemaorg.addressCountry]: addressCountry,
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Builds the flattened `meta.claims` projection for a tenant-service semantic
|
|
80
|
+
* subject.
|
|
81
|
+
*
|
|
82
|
+
* @param input Optional overrides for the synthetic projection.
|
|
83
|
+
* @returns Flat operational claims derived from the semantic subject.
|
|
84
|
+
*/
|
|
85
|
+
export function buildExampleTenantServiceMetaClaims(input = {}) {
|
|
86
|
+
const serviceTypes = input.serviceTypes || [ServiceCapabilityToken.IndexProvider];
|
|
87
|
+
const categories = input.categories || [EXAMPLE_SECTOR];
|
|
88
|
+
const areaServed = input.areaServed || ['EU'];
|
|
89
|
+
const addressCountry = input.addressCountry || EXAMPLE_JURISDICTION;
|
|
90
|
+
return {
|
|
91
|
+
[ClaimsServiceSchemaorg.serviceType]: serializeServiceCapabilityTokens(serviceTypes),
|
|
92
|
+
[ClaimsServiceSchemaorg.category]: firstOrCsv(categories),
|
|
93
|
+
[ClaimsServiceSchemaorg.areaServed]: firstOrCsv(areaServed),
|
|
94
|
+
[ClaimsOrganizationSchemaorg.addressCountry]: addressCountry,
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Builds a synthetic published-provider record as it would appear in a host
|
|
99
|
+
* service-autodiscovery catalog.
|
|
100
|
+
*
|
|
101
|
+
* URL rule:
|
|
102
|
+
* - `discoveryUrl` is the participant-scoped `/.well-known/dspace-version`
|
|
103
|
+
* entrypoint
|
|
104
|
+
* - `catalogUrl` is the derived `/dsp/catalog/dcat.json` artifact
|
|
105
|
+
*
|
|
106
|
+
* @param input Optional overrides for the synthetic provider publication.
|
|
107
|
+
* @returns Shared host-catalog provider entry.
|
|
108
|
+
*/
|
|
109
|
+
export function buildExamplePublishedProviderCatalogRecord(input = {}) {
|
|
110
|
+
const serviceTypes = input.serviceTypes || [ServiceCapabilityToken.IndexProvider];
|
|
111
|
+
const categories = input.categories || [EXAMPLE_SECTOR];
|
|
112
|
+
const areaServed = input.areaServed || ['EU'];
|
|
113
|
+
return {
|
|
114
|
+
providerDid: input.did || EXAMPLE_TENANT_SERVICE_DID,
|
|
115
|
+
serviceType: serviceTypes[0] || ServiceCapabilityToken.IndexProvider,
|
|
116
|
+
category: categories[0] || EXAMPLE_SECTOR,
|
|
117
|
+
areaServed: firstOrCsv(areaServed) || 'EU',
|
|
118
|
+
endpointUrl: EXAMPLE_PROVIDER_PUBLISHED_ENDPOINT_URL,
|
|
119
|
+
discoveryUrl: EXAMPLE_HOSTING_OPERATOR_DSPACE_VERSION_URL,
|
|
120
|
+
catalogUrl: EXAMPLE_HOSTING_OPERATOR_CATALOG_ARTIFACT_URL,
|
|
121
|
+
};
|
|
122
|
+
}
|
|
123
|
+
/**
|
|
124
|
+
* Builds a synthetic host/operator service-autodiscovery catalog.
|
|
125
|
+
*
|
|
126
|
+
* URL rule:
|
|
127
|
+
* - `discoveryUrl` is the canonical entrypoint clients should fetch first
|
|
128
|
+
* - `catalogUrl` is the read-only DSP artifact derived from the advertised
|
|
129
|
+
* base path
|
|
130
|
+
*
|
|
131
|
+
* @param providers Optional published providers to include.
|
|
132
|
+
* @returns Shared catalog DTO for host-side public service autodiscovery.
|
|
133
|
+
*/
|
|
134
|
+
export function buildExampleHostingOperatorDiscoveryCatalog(providers = [buildExamplePublishedProviderCatalogRecord()]) {
|
|
135
|
+
return {
|
|
136
|
+
hostingOperatorDid: EXAMPLE_HOSTING_OPERATOR_DID,
|
|
137
|
+
discoveryUrl: EXAMPLE_HOSTING_OPERATOR_DSPACE_VERSION_URL,
|
|
138
|
+
catalogUrl: EXAMPLE_HOSTING_OPERATOR_CATALOG_ARTIFACT_URL,
|
|
139
|
+
providers: [...providers],
|
|
140
|
+
};
|
|
141
|
+
}
|
package/dist/examples/index.d.ts
CHANGED
package/dist/examples/index.js
CHANGED
|
@@ -20,7 +20,7 @@ export declare const EXAMPLE_TENANT_ROUTE_CONTEXT: {
|
|
|
20
20
|
};
|
|
21
21
|
export declare const EXAMPLE_HOST_ROUTE_CONTEXT: {
|
|
22
22
|
readonly jurisdiction: "ES";
|
|
23
|
-
readonly sector: "
|
|
23
|
+
readonly sector: "test";
|
|
24
24
|
};
|
|
25
25
|
export declare const EXAMPLE_CONTROLLER_DID: "did:web:people.acme.org:controllers:primary";
|
|
26
26
|
export declare const EXAMPLE_CONTROLLER_EMAIL: "controller@acme.org";
|
|
@@ -31,6 +31,22 @@ export declare const EXAMPLE_SUBJECT_DID: "did:web:api.acme.org:individual:123";
|
|
|
31
31
|
export declare const EXAMPLE_PROFESSIONAL_DID: "did:web:api.acme.org:professional:1";
|
|
32
32
|
export declare const EXAMPLE_PROVIDER_ORGANIZATION_DID: "did:web:hospital.acme.org";
|
|
33
33
|
export declare const EXAMPLE_PROVIDER_ORGANIZATION_URL: "https://hospital.acme.org";
|
|
34
|
+
export declare const EXAMPLE_GATEWAY_PUBLIC_ORIGIN: "https://gateway.example.com";
|
|
35
|
+
export declare const EXAMPLE_HOST_PUBLIC_HOSTNAME: "host.example.com";
|
|
36
|
+
export declare const EXAMPLE_HOSTING_OPERATOR_DID: "did:web:host.example.org";
|
|
37
|
+
export declare const EXAMPLE_TENANT_SERVICE_DID: "did:web:provider.example.org";
|
|
38
|
+
export declare const EXAMPLE_SECONDARY_TENANT_SERVICE_DID: "did:web:provider-b.example.org";
|
|
39
|
+
export declare const EXAMPLE_HOSTING_OPERATOR_DSPACE_VERSION_URL: "https://host.example.org/host/cds-ES/v1/test/.well-known/dspace-version";
|
|
40
|
+
export declare const EXAMPLE_HOSTING_OPERATOR_CATALOG_ARTIFACT_URL: "https://host.example.org/host/cds-ES/v1/test/dsp/catalog/dcat.json";
|
|
41
|
+
/** @deprecated Use `EXAMPLE_HOSTING_OPERATOR_DSPACE_VERSION_URL`. */
|
|
42
|
+
export declare const EXAMPLE_HOSTING_OPERATOR_CATALOG_URL: "https://host.example.org/host/cds-ES/v1/test/.well-known/dspace-version";
|
|
43
|
+
export declare const EXAMPLE_PROVIDER_PUBLISHED_ENDPOINT_URL: "https://host.example.org/catalog/provider-a";
|
|
44
|
+
export declare const EXAMPLE_PROVIDER_LEGAL_NAME: "ACME Health Provider";
|
|
45
|
+
export declare const EXAMPLE_SECONDARY_PROVIDER_LEGAL_NAME: "Reader Only Provider";
|
|
46
|
+
export declare const EXAMPLE_SECONDARY_PROVIDER_ALTERNATE_NAME: "reader-only";
|
|
47
|
+
export declare const EXAMPLE_COVERAGE_SCOPE_EU: "EU";
|
|
48
|
+
export declare const EXAMPLE_NON_EU_COUNTRY: "US";
|
|
49
|
+
export declare const EXAMPLE_SECONDARY_EU_COUNTRY: "PT";
|
|
34
50
|
export declare const EXAMPLE_PATIENT_DID: "did:web:patient.example";
|
|
35
51
|
export declare const EXAMPLE_PROFILE_PROVIDER_DID: "did:web:provider.example.org";
|
|
36
52
|
export declare const EXAMPLE_PROFILE_ORGANIZATION_DID: "did:web:org.example";
|
|
@@ -183,3 +199,10 @@ export declare function buildExampleDocumentReferenceSearchPayload(subjectDid?:
|
|
|
183
199
|
};
|
|
184
200
|
};
|
|
185
201
|
export declare function cloneExample<T>(value: T): T;
|
|
202
|
+
export type ExampleHostedTenantRouteContext = Readonly<{
|
|
203
|
+
alternateName: string;
|
|
204
|
+
jurisdiction: string;
|
|
205
|
+
version: string;
|
|
206
|
+
sector: string;
|
|
207
|
+
}>;
|
|
208
|
+
export declare function buildExampleHostedTenantBaseUrl(input: ExampleHostedTenantRouteContext): string;
|