@undefineds.co/xpod 0.4.32 → 0.4.34
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/api/auth/SolidTokenAuthenticator.d.ts +4 -1
- package/dist/api/auth/SolidTokenAuthenticator.js +43 -25
- package/dist/api/container/common.js +1 -0
- package/dist/api/container/index.js +1 -0
- package/dist/api/container/types.d.ts +2 -0
- package/dist/http/SubgraphSparqlHttpHandler.d.ts +32 -0
- package/dist/http/SubgraphSparqlHttpHandler.js +448 -1
- package/dist/http/SubgraphSparqlHttpHandler.jsonld +36 -0
- package/dist/storage/rdf/QleverSparqlEngine.d.ts +15 -0
- package/dist/storage/rdf/QleverSparqlEngine.js +40 -0
- package/dist/storage/rdf/QleverSparqlEngine.jsonld +8 -0
- package/dist/storage/rdf/RdfAccessScope.d.ts +12 -0
- package/dist/storage/rdf/RdfAccessScope.js +63 -3
- package/dist/storage/rdf/RdfQuerySparqlEngine.d.ts +7 -0
- package/dist/storage/rdf/RdfQuerySparqlEngine.js +30 -0
- package/dist/storage/rdf/RdfQuerySparqlEngine.jsonld +8 -0
- package/dist/storage/rdf/index.d.ts +1 -1
- package/dist/storage/rdf/index.js +6 -2
- package/dist/storage/sparql/SubgraphQueryEngine.d.ts +5 -0
- package/dist/storage/sparql/SubgraphQueryEngine.js +9 -0
- package/dist/storage/sparql/SubgraphQueryEngine.jsonld +16 -0
- package/node_modules/@undefineds.co/ai-connections/dist/AiBuiltinProvidersSection.d.ts +32 -0
- package/node_modules/@undefineds.co/ai-connections/dist/AiBuiltinProvidersSection.js +8 -0
- package/node_modules/@undefineds.co/ai-connections/dist/AiConnectionsPanel.js +35 -1
- package/node_modules/@undefineds.co/ai-connections/dist/AiGatewayKeysSection.d.ts +9 -1
- package/node_modules/@undefineds.co/ai-connections/dist/AiGatewayKeysSection.js +32 -6
- package/node_modules/@undefineds.co/ai-connections/dist/index.d.ts +1 -0
- package/node_modules/@undefineds.co/ai-connections/dist/index.js +1 -0
- package/node_modules/@undefineds.co/ai-connections/package.json +2 -2
- package/node_modules/@undefineds.co/ai-connections-runtime/dist/contract/ai-connections-client.d.ts +1 -1
- package/node_modules/@undefineds.co/ai-connections-runtime/dist/contract/client/normalize.d.ts +16 -1
- package/node_modules/@undefineds.co/ai-connections-runtime/dist/contract/client/normalize.js +80 -2
- package/node_modules/@undefineds.co/ai-connections-runtime/dist/contract/client/request.js +19 -1
- package/node_modules/@undefineds.co/ai-connections-runtime/dist/contract/client/types.d.ts +31 -0
- package/node_modules/@undefineds.co/ai-connections-runtime/dist/materials/build-provenance.json +4 -4
- package/node_modules/@undefineds.co/ai-connections-runtime/dist/materials/index.json +15 -15
- package/node_modules/@undefineds.co/ai-connections-runtime/dist/materials/javascript/provider-catalog/index.json +2 -2
- package/node_modules/@undefineds.co/ai-connections-runtime/dist/materials/javascript/service-access-resources/index.json +2 -2
- package/node_modules/@undefineds.co/ai-connections-runtime/dist/materials/source/package.json +1 -1
- package/node_modules/@undefineds.co/ai-connections-runtime/dist/materials/source-inventory.json +11 -11
- package/node_modules/@undefineds.co/ai-connections-runtime/dist/provider-catalog-inputs.json +1 -1
- package/node_modules/@undefineds.co/ai-connections-runtime/dist/service-access-resources-inputs.json +1 -1
- package/node_modules/@undefineds.co/ai-connections-runtime/package.json +1 -1
- package/node_modules/@undefineds.co/extension-host-contracts/dist/materials/build-provenance.json +1 -1
- package/node_modules/@undefineds.co/extension-host-contracts/dist/materials/index.json +3 -3
- package/node_modules/@undefineds.co/extension-host-contracts/dist/materials/source-inventory.json +1 -1
- package/node_modules/@undefineds.co/xpod-afs/dist/licenses/cli-producer-original-binding.json +1 -1
- package/node_modules/@undefineds.co/xpod-cli/dist/producer-materials/index.json +1 -1
- package/package.json +4 -4
- package/static/dashboard/assets/{AccountAuthBoundary-D2peXpst.js → AccountAuthBoundary-DXBGmvsI.js} +1 -1
- package/static/dashboard/assets/{DesktopOidcCallback-DXWArav6.js → DesktopOidcCallback-p24MYq1P.js} +1 -1
- package/static/dashboard/assets/{DevicePages-BULFk95K.js → DevicePages-DbvhTnse.js} +1 -1
- package/static/dashboard/assets/ModelsPage-UMDnRyLA.js +12 -0
- package/static/dashboard/assets/{PaneListHeader-BSfEbecP.js → PaneListHeader-DkEH0TT_.js} +1 -1
- package/static/dashboard/assets/{PodDeletionAuthorizationPanel-CH-Sx18g.js → PodDeletionAuthorizationPanel-CzrI8Pgw.js} +3 -3
- package/static/dashboard/assets/{PodPage-BMpejIra.js → PodPage-TaiWqMBx.js} +1 -1
- package/static/dashboard/assets/{SystemSettingsPage-H_Jj6WfF.js → SystemSettingsPage-D4gQjDt1.js} +1 -1
- package/static/dashboard/assets/{TasksPage-CTDxlQra.js → TasksPage-CmkiMYil.js} +1 -1
- package/static/dashboard/assets/{WebDesktopEntry-Ch7-0C9a.js → WebDesktopEntry-D9kEfhbz.js} +1 -1
- package/static/dashboard/assets/{XpodAiConnectionsPodStore-ggRE9fmE.js → XpodAiConnectionsPodStore-orY8vQFl.js} +2 -2
- package/static/dashboard/assets/{XpodShellApp-Bwf9UmeJ.js → XpodShellApp-DR65DMOb.js} +4 -4
- package/static/dashboard/assets/{account-session-CVzooxS2.js → account-session-BZ2ttIdq.js} +1 -1
- package/static/dashboard/assets/{button-DGh2QVt2.js → button-_rwfCMMH.js} +1 -1
- package/static/dashboard/assets/{collection-runtime-DwV_9rt2.js → collection-runtime-C74icLtf.js} +1 -1
- package/static/dashboard/assets/{createLucideIcon-yLhAxnfL.js → createLucideIcon-DrgScGhc.js} +1 -1
- package/static/dashboard/assets/{dashboard-xbXlitKr.js → dashboard--DWjqkYt.js} +2 -2
- package/static/dashboard/assets/{index-CMigfjqD.js → index-D6dB-UNq.js} +1 -1
- package/static/dashboard/assets/{index-BSiKqEdo.js → index-dx5sc4rE.js} +1 -1
- package/static/dashboard/assets/{label-CrDv_y1q.js → label-D02Jpvm9.js} +1 -1
- package/static/dashboard/assets/{list-BJM0nqti.js → list-DpFAisnq.js} +1 -1
- package/static/dashboard/assets/{nav-item-style-CQbGyYLb.js → nav-item-style-B1-0JkON.js} +1 -1
- package/static/dashboard/assets/{safe-continuation-ZTBQTFWB.js → safe-continuation-DUTIOFe5.js} +1 -1
- package/static/dashboard/assets/{section-header-CWHRWGXl.js → section-header-CtBnllbG.js} +1 -1
- package/static/dashboard/assets/{setting-row-qWtxYGK1.js → setting-row-D_JPuHAJ.js} +1 -1
- package/static/dashboard/assets/{xpod-remembered-login-DPMxurVN.js → xpod-remembered-login-CtmMI8xG.js} +3 -3
- package/static/dashboard/dashboard.html +1 -1
- package/static/settings/assets/{AccountAuthBoundary-4Ywjpb8o.js → AccountAuthBoundary-njIhHpLf.js} +1 -1
- package/static/settings/assets/{DesktopOidcCallback-CAmwMT_J.js → DesktopOidcCallback-BjjNwTxc.js} +1 -1
- package/static/settings/assets/{DevicePages-DvuHyfHo.js → DevicePages-FFJMu_zL.js} +1 -1
- package/static/settings/assets/ModelsPage-6567dZKQ.js +12 -0
- package/static/settings/assets/{PaneListHeader-CuFgIbhe.js → PaneListHeader-CuPah5aC.js} +1 -1
- package/static/settings/assets/{PodDeletionAuthorizationPanel-DdNgDHH5.js → PodDeletionAuthorizationPanel-aJCKasGz.js} +3 -3
- package/static/settings/assets/{PodPage-DnWCNGTO.js → PodPage-BA0DQ3AB.js} +1 -1
- package/static/settings/assets/{SystemSettingsPage-k9P_wQcl.js → SystemSettingsPage-BNPH4VWf.js} +1 -1
- package/static/settings/assets/{TasksPage-Dk7gUH3J.js → TasksPage-B5m82wjD.js} +1 -1
- package/static/settings/assets/{WebDesktopEntry-DJwPVVnU.js → WebDesktopEntry-DgwwIUhg.js} +1 -1
- package/static/settings/assets/{XpodAiConnectionsPodStore-BtJQiJsx.js → XpodAiConnectionsPodStore-BJm-rFPs.js} +2 -2
- package/static/settings/assets/{XpodShellApp-B47vEQJp.js → XpodShellApp-BwvekJJR.js} +4 -4
- package/static/settings/assets/{XpodThemeProvider-Ciuwo_yl.js → XpodThemeProvider-DyX0rUID.js} +2 -2
- package/static/settings/assets/{account-session-CMc10iEj.js → account-session-D6vibAra.js} +1 -1
- package/static/settings/assets/auth-callback-DXxmF0-p.js +1 -0
- package/static/settings/assets/{button-D1dGKY1f.js → button-CV4KJ59A.js} +1 -1
- package/static/settings/assets/{collection-runtime-hK37-47o.js → collection-runtime-CARp4Cii.js} +1 -1
- package/static/settings/assets/{createLucideIcon-nEiQH43b.js → createLucideIcon-BIwq0vQx.js} +1 -1
- package/static/settings/assets/{index-DNdvma6J.js → index-D-LgcKAb.js} +1 -1
- package/static/settings/assets/{label-C3EGk_2E.js → label-CFTl2bC_.js} +1 -1
- package/static/settings/assets/{list-BensBGZp.js → list-D2aO7Nu-.js} +1 -1
- package/static/settings/assets/{nav-item-style-BOKCPNz8.js → nav-item-style-BKpK5_1m.js} +1 -1
- package/static/settings/assets/{safe-continuation-BPwW6jdq.js → safe-continuation-DRRY_t4F.js} +1 -1
- package/static/settings/assets/{section-header-DOSj5RvJ.js → section-header-COECjyL5.js} +1 -1
- package/static/settings/assets/{setting-row-C9k4cGNM.js → setting-row-cGgL78vR.js} +1 -1
- package/static/settings/assets/{settings-DtP5C8hi.js → settings-Bvrm5N-k.js} +1 -1
- package/static/settings/assets/{xpod-remembered-login-DKFG-zi3.js → xpod-remembered-login-YAmn8ZiP.js} +3 -3
- package/static/settings/auth-callback.html +2 -2
- package/static/settings/settings.html +2 -2
- package/static/dashboard/assets/ModelsPage-xvsVzhGZ.js +0 -12
- package/static/settings/assets/ModelsPage-BDXqetwk.js +0 -12
- package/static/settings/assets/auth-callback-fcOBaX2w.js +0 -1
|
@@ -224,6 +224,42 @@
|
|
|
224
224
|
"@id": "undefineds:dist/http/SubgraphSparqlHttpHandler.jsonld#SubgraphSparqlHttpHandler__member_acceptsJson",
|
|
225
225
|
"memberFieldName": "acceptsJson"
|
|
226
226
|
},
|
|
227
|
+
{
|
|
228
|
+
"@id": "undefineds:dist/http/SubgraphSparqlHttpHandler.jsonld#SubgraphSparqlHttpHandler__member_classifyMetadataRead",
|
|
229
|
+
"memberFieldName": "classifyMetadataRead"
|
|
230
|
+
},
|
|
231
|
+
{
|
|
232
|
+
"@id": "undefineds:dist/http/SubgraphSparqlHttpHandler.jsonld#SubgraphSparqlHttpHandler__member_unsupportedMetadataSignal",
|
|
233
|
+
"memberFieldName": "unsupportedMetadataSignal"
|
|
234
|
+
},
|
|
235
|
+
{
|
|
236
|
+
"@id": "undefineds:dist/http/SubgraphSparqlHttpHandler.jsonld#SubgraphSparqlHttpHandler__member_resolveMetadataSubjectVariable",
|
|
237
|
+
"memberFieldName": "resolveMetadataSubjectVariable"
|
|
238
|
+
},
|
|
239
|
+
{
|
|
240
|
+
"@id": "undefineds:dist/http/SubgraphSparqlHttpHandler.jsonld#SubgraphSparqlHttpHandler__member_hasMetadataGraphExpectedBind",
|
|
241
|
+
"memberFieldName": "hasMetadataGraphExpectedBind"
|
|
242
|
+
},
|
|
243
|
+
{
|
|
244
|
+
"@id": "undefineds:dist/http/SubgraphSparqlHttpHandler.jsonld#SubgraphSparqlHttpHandler__member_hasBoundedMetadataGraphFilter",
|
|
245
|
+
"memberFieldName": "hasBoundedMetadataGraphFilter"
|
|
246
|
+
},
|
|
247
|
+
{
|
|
248
|
+
"@id": "undefineds:dist/http/SubgraphSparqlHttpHandler.jsonld#SubgraphSparqlHttpHandler__member_hasMetadataGraphSubjectBinding",
|
|
249
|
+
"memberFieldName": "hasMetadataGraphSubjectBinding"
|
|
250
|
+
},
|
|
251
|
+
{
|
|
252
|
+
"@id": "undefineds:dist/http/SubgraphSparqlHttpHandler.jsonld#SubgraphSparqlHttpHandler__member_executeMetadataSelect",
|
|
253
|
+
"memberFieldName": "executeMetadataSelect"
|
|
254
|
+
},
|
|
255
|
+
{
|
|
256
|
+
"@id": "undefineds:dist/http/SubgraphSparqlHttpHandler.jsonld#SubgraphSparqlHttpHandler__member_metadataResourceForGraph",
|
|
257
|
+
"memberFieldName": "metadataResourceForGraph"
|
|
258
|
+
},
|
|
259
|
+
{
|
|
260
|
+
"@id": "undefineds:dist/http/SubgraphSparqlHttpHandler.jsonld#SubgraphSparqlHttpHandler__member_metadataRowAllowed",
|
|
261
|
+
"memberFieldName": "metadataRowAllowed"
|
|
262
|
+
},
|
|
227
263
|
{
|
|
228
264
|
"@id": "undefineds:dist/http/SubgraphSparqlHttpHandler.jsonld#SubgraphSparqlHttpHandler__member_executeSelect",
|
|
229
265
|
"memberFieldName": "executeSelect"
|
|
@@ -18,6 +18,21 @@ export declare class QleverSparqlEngine implements SparqlEngine {
|
|
|
18
18
|
private readonly rdfEngine;
|
|
19
19
|
constructor(rdfEngine: RdfEngineLike);
|
|
20
20
|
queryBindings(query: string, basePath: string, accessScope?: RdfAccessScope, options?: SparqlQueryOptions): Promise<QleverBindingsStream>;
|
|
21
|
+
/**
|
|
22
|
+
* Explicit metadata facet read.
|
|
23
|
+
*
|
|
24
|
+
* The native runtime derives BOTH its graph prefix and its source URI prefix
|
|
25
|
+
* from `basePath`. Metadata quads are written without a source attribution
|
|
26
|
+
* (`SolidRdfDataAccessor.replaceMetadata` -> `rdfEngine.put` with no source),
|
|
27
|
+
* so a `meta:` basePath would make the physical scan join `rdf_sources` and
|
|
28
|
+
* drop every metadata row. A metadata-only query therefore runs with no
|
|
29
|
+
* basePath (graph scope ALL) and a mandatory finite ACL scope whose
|
|
30
|
+
* `basePath` is `meta:{base}`; the backend applies that allowed-graph-prefix
|
|
31
|
+
* to every scan. Callers must supply the scope: this method throws rather
|
|
32
|
+
* than fall back to an unscoped read.
|
|
33
|
+
*/
|
|
34
|
+
queryMetadataBindings(query: string, basePath: string, accessScope?: RdfAccessScope, options?: SparqlQueryOptions): Promise<QleverBindingsStream>;
|
|
35
|
+
listMetadataGraphs(basePath: string, accessScope?: RdfAccessScope): Promise<Set<string>>;
|
|
21
36
|
queryBoolean(query: string, basePath: string, accessScope?: RdfAccessScope, options?: SparqlQueryOptions): Promise<boolean>;
|
|
22
37
|
queryQuads(query: string, basePath: string, accessScope?: RdfAccessScope, options?: SparqlQueryOptions): Promise<AsyncIterator<Quad>>;
|
|
23
38
|
queryVoid(_query: string, _basePath: string, _accessScope?: RdfAccessScope, _options?: SparqlVoidOptions): Promise<void>;
|
|
@@ -4,6 +4,7 @@ exports.QleverSparqlEngine = void 0;
|
|
|
4
4
|
const asynciterator_1 = require("asynciterator");
|
|
5
5
|
const n3_1 = require("n3");
|
|
6
6
|
const rdf_data_factory_1 = require("rdf-data-factory");
|
|
7
|
+
const RdfAccessScope_1 = require("./RdfAccessScope");
|
|
7
8
|
const RdfSparqlBoundary_1 = require("./RdfSparqlBoundary");
|
|
8
9
|
const RdfSparqlSerialization_1 = require("./RdfSparqlSerialization");
|
|
9
10
|
const rdfDataFactory = new rdf_data_factory_1.DataFactory();
|
|
@@ -35,6 +36,45 @@ class QleverSparqlEngine {
|
|
|
35
36
|
});
|
|
36
37
|
return iterator;
|
|
37
38
|
}
|
|
39
|
+
/**
|
|
40
|
+
* Explicit metadata facet read.
|
|
41
|
+
*
|
|
42
|
+
* The native runtime derives BOTH its graph prefix and its source URI prefix
|
|
43
|
+
* from `basePath`. Metadata quads are written without a source attribution
|
|
44
|
+
* (`SolidRdfDataAccessor.replaceMetadata` -> `rdfEngine.put` with no source),
|
|
45
|
+
* so a `meta:` basePath would make the physical scan join `rdf_sources` and
|
|
46
|
+
* drop every metadata row. A metadata-only query therefore runs with no
|
|
47
|
+
* basePath (graph scope ALL) and a mandatory finite ACL scope whose
|
|
48
|
+
* `basePath` is `meta:{base}`; the backend applies that allowed-graph-prefix
|
|
49
|
+
* to every scan. Callers must supply the scope: this method throws rather
|
|
50
|
+
* than fall back to an unscoped read.
|
|
51
|
+
*/
|
|
52
|
+
async queryMetadataBindings(query, basePath, accessScope, options) {
|
|
53
|
+
const metadataBase = `${RdfAccessScope_1.METADATA_GRAPH_PREFIX}${basePath}`;
|
|
54
|
+
if (!accessScope?.basePath?.startsWith(metadataBase)) {
|
|
55
|
+
throw new RdfSparqlBoundary_1.UnsupportedSparqlQueryError('Native metadata reads require a finite meta: access scope.');
|
|
56
|
+
}
|
|
57
|
+
return this.queryBindings(query, '', {
|
|
58
|
+
...accessScope,
|
|
59
|
+
basePath: metadataBase,
|
|
60
|
+
mode: 'read',
|
|
61
|
+
}, { ...options, defaultDataset: 'physical' });
|
|
62
|
+
}
|
|
63
|
+
async listMetadataGraphs(basePath, accessScope) {
|
|
64
|
+
const metadataBase = `${RdfAccessScope_1.METADATA_GRAPH_PREFIX}${basePath}`;
|
|
65
|
+
if (!accessScope?.basePath?.startsWith(metadataBase)) {
|
|
66
|
+
throw new RdfSparqlBoundary_1.UnsupportedSparqlQueryError('Native metadata reads require a finite meta: access scope.');
|
|
67
|
+
}
|
|
68
|
+
const stream = await this.queryBindings('SELECT DISTINCT ?g WHERE { GRAPH ?g { ?s ?p ?o } }', '', { ...accessScope, basePath: metadataBase, mode: 'read' }, { defaultDataset: 'physical' });
|
|
69
|
+
const graphs = new Set();
|
|
70
|
+
for await (const binding of stream) {
|
|
71
|
+
const graph = binding.get('g');
|
|
72
|
+
if (graph?.termType === 'NamedNode' && graph.value.startsWith(metadataBase)) {
|
|
73
|
+
graphs.add(graph.value);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
return graphs;
|
|
77
|
+
}
|
|
38
78
|
async queryBoolean(query, basePath, accessScope, options) {
|
|
39
79
|
const result = await this.execute(query, basePath, 'queryBoolean', 'application/sparql-results+json', accessScope, options);
|
|
40
80
|
const payload = parseSparqlJson(result);
|
|
@@ -31,6 +31,14 @@
|
|
|
31
31
|
"@id": "undefineds:dist/storage/rdf/QleverSparqlEngine.jsonld#QleverSparqlEngine__member_queryBindings",
|
|
32
32
|
"memberFieldName": "queryBindings"
|
|
33
33
|
},
|
|
34
|
+
{
|
|
35
|
+
"@id": "undefineds:dist/storage/rdf/QleverSparqlEngine.jsonld#QleverSparqlEngine__member_queryMetadataBindings",
|
|
36
|
+
"memberFieldName": "queryMetadataBindings"
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
"@id": "undefineds:dist/storage/rdf/QleverSparqlEngine.jsonld#QleverSparqlEngine__member_listMetadataGraphs",
|
|
40
|
+
"memberFieldName": "listMetadataGraphs"
|
|
41
|
+
},
|
|
34
42
|
{
|
|
35
43
|
"@id": "undefineds:dist/storage/rdf/QleverSparqlEngine.jsonld#QleverSparqlEngine__member_queryBoolean",
|
|
36
44
|
"memberFieldName": "queryBoolean"
|
|
@@ -22,5 +22,17 @@ export interface RdfAccessScope {
|
|
|
22
22
|
export declare function isRestrictiveRdfAccessScope(scope?: RdfAccessScope): boolean;
|
|
23
23
|
export declare function rdfAccessCacheScope(scope?: RdfAccessScope): RdfQueryCacheScope | undefined;
|
|
24
24
|
export declare function applyRdfAccessScope(query: RdfQuery, scope?: RdfAccessScope): RdfQuery;
|
|
25
|
+
/** Metadata facets are stored under the literal scheme prefix `meta:`. */
|
|
26
|
+
export declare const METADATA_GRAPH_PREFIX = "meta:";
|
|
27
|
+
export declare function isMetadataGraphIri(graph: string): boolean;
|
|
28
|
+
/** The subject resource a metadata facet graph belongs to. */
|
|
29
|
+
export declare function metadataResourceForGraph(graph: string): string | undefined;
|
|
25
30
|
export declare function filterRdfAccessGraphs(graphs: Iterable<string>, scope?: RdfAccessScope): Set<string>;
|
|
31
|
+
/**
|
|
32
|
+
* Read-side graph permission. A metadata facet graph is readable exactly when
|
|
33
|
+
* its subject resource is readable; the alias never widens the subject ACL.
|
|
34
|
+
* This is deliberately separate from {@link rdfAccessGraphAllowed}, which stays
|
|
35
|
+
* the literal write guard.
|
|
36
|
+
*/
|
|
37
|
+
export declare function rdfReadGraphAllowed(graph: string, scope: RdfAccessScope): boolean;
|
|
26
38
|
export declare function rdfAccessGraphAllowed(graph: string, scope: RdfAccessScope): boolean;
|
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.RdfAccessMode = void 0;
|
|
3
|
+
exports.METADATA_GRAPH_PREFIX = exports.RdfAccessMode = void 0;
|
|
4
4
|
exports.isRestrictiveRdfAccessScope = isRestrictiveRdfAccessScope;
|
|
5
5
|
exports.rdfAccessCacheScope = rdfAccessCacheScope;
|
|
6
6
|
exports.applyRdfAccessScope = applyRdfAccessScope;
|
|
7
|
+
exports.isMetadataGraphIri = isMetadataGraphIri;
|
|
8
|
+
exports.metadataResourceForGraph = metadataResourceForGraph;
|
|
7
9
|
exports.filterRdfAccessGraphs = filterRdfAccessGraphs;
|
|
10
|
+
exports.rdfReadGraphAllowed = rdfReadGraphAllowed;
|
|
8
11
|
exports.rdfAccessGraphAllowed = rdfAccessGraphAllowed;
|
|
9
12
|
const n3_1 = require("n3");
|
|
10
13
|
const types_1 = require("../quint/types");
|
|
@@ -66,6 +69,15 @@ function mergeRdfQueryCacheScopes(existing, access) {
|
|
|
66
69
|
}
|
|
67
70
|
return [existing, access];
|
|
68
71
|
}
|
|
72
|
+
/** Metadata facets are stored under the literal scheme prefix `meta:`. */
|
|
73
|
+
exports.METADATA_GRAPH_PREFIX = 'meta:';
|
|
74
|
+
function isMetadataGraphIri(graph) {
|
|
75
|
+
return graph.startsWith(exports.METADATA_GRAPH_PREFIX) && !graph.startsWith(`${exports.METADATA_GRAPH_PREFIX}${exports.METADATA_GRAPH_PREFIX}`);
|
|
76
|
+
}
|
|
77
|
+
/** The subject resource a metadata facet graph belongs to. */
|
|
78
|
+
function metadataResourceForGraph(graph) {
|
|
79
|
+
return isMetadataGraphIri(graph) ? graph.slice(exports.METADATA_GRAPH_PREFIX.length) : undefined;
|
|
80
|
+
}
|
|
69
81
|
function filterRdfAccessGraphs(graphs, scope) {
|
|
70
82
|
if (!scope) {
|
|
71
83
|
return new Set(graphs);
|
|
@@ -78,6 +90,50 @@ function filterRdfAccessGraphs(graphs, scope) {
|
|
|
78
90
|
}
|
|
79
91
|
return filtered;
|
|
80
92
|
}
|
|
93
|
+
/**
|
|
94
|
+
* Read-side graph permission. A metadata facet graph is readable exactly when
|
|
95
|
+
* its subject resource is readable; the alias never widens the subject ACL.
|
|
96
|
+
* This is deliberately separate from {@link rdfAccessGraphAllowed}, which stays
|
|
97
|
+
* the literal write guard.
|
|
98
|
+
*/
|
|
99
|
+
function rdfReadGraphAllowed(graph, scope) {
|
|
100
|
+
const resource = metadataResourceForGraph(graph);
|
|
101
|
+
// A metadata-namespace scope is created ONLY by the explicit metadata read
|
|
102
|
+
// request (`queryMetadataBindings`/`listMetadataGraphs` prefix the base with
|
|
103
|
+
// `meta:`). Every ordinary read scope uses the data base, and there the
|
|
104
|
+
// `meta:` alias must stay invisible: widening it here would expose facets to
|
|
105
|
+
// ASK/CONSTRUCT/subqueries that never perform the per-subject authorization.
|
|
106
|
+
const metadataScope = scope.basePath.startsWith(exports.METADATA_GRAPH_PREFIX);
|
|
107
|
+
const resourceBase = metadataScope
|
|
108
|
+
? scope.basePath.slice(exports.METADATA_GRAPH_PREFIX.length)
|
|
109
|
+
: scope.basePath;
|
|
110
|
+
// Canonical-equivalent aliasing: a scope expressed over `meta:<base>` and a
|
|
111
|
+
// scope expressed over `<base>` name the same subject resources, so an
|
|
112
|
+
// explicit deny of either form must win over the literal allow below.
|
|
113
|
+
const aliases = resource === undefined
|
|
114
|
+
? [graph, `${exports.METADATA_GRAPH_PREFIX}${graph}`]
|
|
115
|
+
: [graph, resource];
|
|
116
|
+
if ((scope.deniedGraphUrls ?? []).some((denied) => aliases.includes(denied))) {
|
|
117
|
+
return false;
|
|
118
|
+
}
|
|
119
|
+
if ((scope.deniedGraphPrefixes ?? []).some((prefix) => aliases.some((alias) => alias.startsWith(prefix))
|
|
120
|
+
|| (prefix === exports.METADATA_GRAPH_PREFIX && resource !== undefined)
|
|
121
|
+
|| (prefix.startsWith(exports.METADATA_GRAPH_PREFIX) && aliases.includes(prefix.slice(exports.METADATA_GRAPH_PREFIX.length))))) {
|
|
122
|
+
return false;
|
|
123
|
+
}
|
|
124
|
+
if (rdfAccessGraphAllowed(graph, scope)) {
|
|
125
|
+
return true;
|
|
126
|
+
}
|
|
127
|
+
if (!metadataScope || resource === undefined || !resource.startsWith(resourceBase)) {
|
|
128
|
+
return false;
|
|
129
|
+
}
|
|
130
|
+
if (scope.allowedGraphUrls !== undefined
|
|
131
|
+
&& !scope.allowedGraphUrls.includes(graph)
|
|
132
|
+
&& !scope.allowedGraphUrls.includes(resource)) {
|
|
133
|
+
return false;
|
|
134
|
+
}
|
|
135
|
+
return true;
|
|
136
|
+
}
|
|
81
137
|
function rdfAccessGraphAllowed(graph, scope) {
|
|
82
138
|
if (!graph.startsWith(scope.basePath)) {
|
|
83
139
|
return false;
|
|
@@ -181,9 +237,13 @@ function scopePattern(pattern, filters, scope, state) {
|
|
|
181
237
|
// Resolving it here rather than inside one engine means every query path - the
|
|
182
238
|
// public authority, the Pod endpoint, a direct engine query - reads the same
|
|
183
239
|
// rule. See docs/rdf-graph-semantics.md.
|
|
240
|
+
// A metadata facet graph is always exact, even when its IRI ends in `/`
|
|
241
|
+
// because its subject is a container. Only data graph IRIs keep the
|
|
242
|
+
// container-prefix meaning.
|
|
184
243
|
const containerPrefix = (0, types_1.isTerm)(requested)
|
|
185
244
|
&& requested.termType === 'NamedNode'
|
|
186
245
|
&& requested.value.endsWith('/')
|
|
246
|
+
&& !isMetadataGraphIri(requested.value)
|
|
187
247
|
? { $startsWith: requested.value }
|
|
188
248
|
: undefined;
|
|
189
249
|
const graph = containerPrefix
|
|
@@ -210,7 +270,7 @@ function scopePattern(pattern, filters, scope, state) {
|
|
|
210
270
|
}
|
|
211
271
|
: { ...pattern, ...(defaultGraphSourceScope ? { sourceScope: defaultGraphSourceScope } : {}) };
|
|
212
272
|
}
|
|
213
|
-
return
|
|
273
|
+
return rdfReadGraphAllowed(graph.value, scope)
|
|
214
274
|
? { ...pattern, ...(sourceScope ? { sourceScope } : {}) }
|
|
215
275
|
: { ...pattern, graph: state.impossibleGraph, ...(sourceScope ? { sourceScope } : {}) };
|
|
216
276
|
}
|
|
@@ -246,7 +306,7 @@ function scopeGraphOperators(graph, scope, impossibleGraph) {
|
|
|
246
306
|
}
|
|
247
307
|
if (scope.allowedGraphUrls !== undefined) {
|
|
248
308
|
const allowedTerms = scope.allowedGraphUrls
|
|
249
|
-
.filter((url) =>
|
|
309
|
+
.filter((url) => rdfReadGraphAllowed(url, scope) && graphOperatorsMayMatch(operators, url))
|
|
250
310
|
.map((url) => n3_1.DataFactory.namedNode(url));
|
|
251
311
|
if (allowedTerms.length === 0) {
|
|
252
312
|
return impossibleGraph;
|
|
@@ -25,6 +25,13 @@ export declare class RdfQuerySparqlEngine implements SparqlEngine {
|
|
|
25
25
|
queryQuads(query: string, basePath: string, accessScope?: RdfAccessScope, options?: SparqlQueryOptions): Promise<AsyncIterator<Quad>>;
|
|
26
26
|
queryVoid(_query: string, _basePath: string, _accessScope?: RdfAccessScope, _options?: SparqlVoidOptions): Promise<void>;
|
|
27
27
|
constructGraph(graph: string, basePath: string, accessScope?: RdfAccessScope): Promise<AsyncIterator<Quad>>;
|
|
28
|
+
/**
|
|
29
|
+
* Metadata facet reads run under the literal `meta:` scheme for this base so
|
|
30
|
+
* the data-prefix scope can never admit a facet accidentally. Collection
|
|
31
|
+
* discovery lists facet graphs from that same namespace.
|
|
32
|
+
*/
|
|
33
|
+
queryMetadataBindings(query: string, basePath: string, accessScope?: RdfAccessScope, options?: SparqlQueryOptions): Promise<RdfBindingsStream>;
|
|
34
|
+
listMetadataGraphs(basePath: string, accessScope?: RdfAccessScope): Promise<Set<string>>;
|
|
28
35
|
listGraphs(basePath: string, accessScope?: RdfAccessScope): Promise<Set<string>>;
|
|
29
36
|
close(): Promise<void>;
|
|
30
37
|
private context;
|
|
@@ -98,6 +98,36 @@ class RdfQuerySparqlEngine {
|
|
|
98
98
|
}
|
|
99
99
|
return new asynciterator_1.ArrayIterator(quads);
|
|
100
100
|
}
|
|
101
|
+
/**
|
|
102
|
+
* Metadata facet reads run under the literal `meta:` scheme for this base so
|
|
103
|
+
* the data-prefix scope can never admit a facet accidentally. Collection
|
|
104
|
+
* discovery lists facet graphs from that same namespace.
|
|
105
|
+
*/
|
|
106
|
+
async queryMetadataBindings(query, basePath, accessScope, options) {
|
|
107
|
+
const metadataBase = `${RdfAccessScope_1.METADATA_GRAPH_PREFIX}${basePath}`;
|
|
108
|
+
return this.queryBindings(query, metadataBase, {
|
|
109
|
+
...accessScope,
|
|
110
|
+
basePath: metadataBase,
|
|
111
|
+
mode: RdfAccessScope_1.RdfAccessMode.READ,
|
|
112
|
+
}, options);
|
|
113
|
+
}
|
|
114
|
+
async listMetadataGraphs(basePath, accessScope) {
|
|
115
|
+
const metadataBase = `${RdfAccessScope_1.METADATA_GRAPH_PREFIX}${basePath}`;
|
|
116
|
+
const stream = await this.queryBindings('SELECT DISTINCT ?g WHERE { GRAPH ?g { ?s ?p ?o } }', metadataBase, { ...accessScope, basePath: metadataBase, mode: RdfAccessScope_1.RdfAccessMode.READ });
|
|
117
|
+
const graphs = new Set();
|
|
118
|
+
for await (const binding of stream) {
|
|
119
|
+
const graph = binding.get('g');
|
|
120
|
+
if (graph?.termType === 'NamedNode' && graph.value.startsWith(metadataBase)) {
|
|
121
|
+
graphs.add(graph.value);
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
const metaScope = {
|
|
125
|
+
...accessScope,
|
|
126
|
+
basePath: metadataBase,
|
|
127
|
+
mode: RdfAccessScope_1.RdfAccessMode.READ,
|
|
128
|
+
};
|
|
129
|
+
return new Set([...graphs].filter((graph) => (0, RdfAccessScope_1.rdfReadGraphAllowed)(graph, metaScope)));
|
|
130
|
+
}
|
|
101
131
|
async listGraphs(basePath, accessScope) {
|
|
102
132
|
const stream = await this.queryBindings('SELECT DISTINCT ?g WHERE { GRAPH ?g { ?s ?p ?o } }', basePath, accessScope);
|
|
103
133
|
const graphs = new Set();
|
|
@@ -51,6 +51,14 @@
|
|
|
51
51
|
"@id": "undefineds:dist/storage/rdf/RdfQuerySparqlEngine.jsonld#RdfQuerySparqlEngine__member_constructGraph",
|
|
52
52
|
"memberFieldName": "constructGraph"
|
|
53
53
|
},
|
|
54
|
+
{
|
|
55
|
+
"@id": "undefineds:dist/storage/rdf/RdfQuerySparqlEngine.jsonld#RdfQuerySparqlEngine__member_queryMetadataBindings",
|
|
56
|
+
"memberFieldName": "queryMetadataBindings"
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
"@id": "undefineds:dist/storage/rdf/RdfQuerySparqlEngine.jsonld#RdfQuerySparqlEngine__member_listMetadataGraphs",
|
|
60
|
+
"memberFieldName": "listMetadataGraphs"
|
|
61
|
+
},
|
|
54
62
|
{
|
|
55
63
|
"@id": "undefineds:dist/storage/rdf/RdfQuerySparqlEngine.jsonld#RdfQuerySparqlEngine__member_listGraphs",
|
|
56
64
|
"memberFieldName": "listGraphs"
|
|
@@ -13,7 +13,7 @@ export type { PostgresRdfSqlExecutor } from './PostgresRdfSqlExecutor';
|
|
|
13
13
|
export { isLineAddressableRdf, isLineAddressableRdfContentType, isLineAddressableRdfPath, isRdfDocument, isRdfDocumentContentType, isRdfDocumentPath, isSafeRdfDocumentContentType, normalizeContentType, rdfContentTypeForPath, } from './RdfContentTypes';
|
|
14
14
|
export { RdfShadowComparator, canonicalQuadKey, diffQuads } from './RdfShadowComparator';
|
|
15
15
|
export { RdfQueryExecutor, variable as rdfVar } from './RdfQueryExecutor';
|
|
16
|
-
export { applyRdfAccessScope, filterRdfAccessGraphs, isRestrictiveRdfAccessScope, rdfAccessCacheScope, rdfAccessGraphAllowed, type RdfAccessMode, type RdfAccessScope, } from './RdfAccessScope';
|
|
16
|
+
export { METADATA_GRAPH_PREFIX, applyRdfAccessScope, filterRdfAccessGraphs, isMetadataGraphIri, isRestrictiveRdfAccessScope, metadataResourceForGraph, rdfAccessCacheScope, rdfAccessGraphAllowed, rdfReadGraphAllowed, type RdfAccessMode, type RdfAccessScope, } from './RdfAccessScope';
|
|
17
17
|
export { SolidRdfEngine, type LocalNativeSparqlClientLike, type SolidRdfEngineOptions, } from './SolidRdfEngine';
|
|
18
18
|
export { LocalQleverNativeSparqlClient, LocalQleverRuntimeError, type LocalQleverNativeSparqlClientOptions, type LocalQleverRuntimeErrorCode, } from './LocalQleverNativeSparqlClient';
|
|
19
19
|
export { QleverSparqlEngine } from './QleverSparqlEngine';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
exports.RDF_MODELS_SYNTHETIC_MESSAGE_QUADS = exports.seedRdfModelsSearchFusionIndexes = exports.runRdfModelsShadowBenchmark = exports.runRdfModelsRdf3xShadowBenchmark = exports.runRdfModelsPostgresBenchmark = exports.runRdfModelsBenchmark = exports.rdfModelsSearchFusionBroadSourceCountForScale = exports.rdfModelsBenchmarkScaleTargetQuads = exports.rdfModelsBenchmarkSyntheticPodCount = exports.rdfModelsBenchmarkTargetSatisfied = exports.rdfModelsBenchmarkScaleSatisfied = exports.rdfModelsBenchmarkProfileRequiresSearchFusion = exports.syntheticMessagesForRdfModelsTargetQuads = exports.estimateRdfModelsSyntheticQuadCount = exports.defaultSyntheticMessagesForRdfModelsScale = exports.buildRdfModelsBenchmarkSeed = exports.RDF_MODELS_BENCHMARK_POD = exports.rdfModelsSearchFusionQueryBenchmarkCaseNames = exports.rdfModelsSearchFusionQueryBenchmarkCases = exports.rdfModelsQueryBenchmarkCasesForProfile = exports.rdfModelsQueryBenchmarkCaseNames = exports.rdfModelsQueryBenchmarkCases = exports.rdfModelsPostgresQueryBenchmarkCasesForProfile = exports.rdfModelsPostgresQueryBenchmarkCaseNames = exports.rdfModelsPostgresQueryBenchmarkCases = exports.rdfModelsPostgresMaterializedQueryBenchmarkCaseNames = exports.rdfModelsPostgresMaterializedQueryBenchmarkCases = exports.rdfModelsExtremeQueryBenchmarkCaseNames = exports.rdfModelsExtremeQueryBenchmarkCases = exports.rdfModelsExtremeBenchmarkCaseNames = exports.rdfModelsExtremeBenchmarkCases = exports.rdfModelsBenchmarkCasesForProfile = exports.rdfModelsBenchmarkCaseNames = exports.rdfModelsBenchmarkCases = exports.assertServerOwnedNativeSparqlQuery = void 0;
|
|
3
|
+
exports.DisabledSparqlFeatureError = exports.PostgresRdfEngine = exports.RdfQuerySparqlEngine = exports.QleverSparqlEngine = exports.LocalQleverRuntimeError = exports.LocalQleverNativeSparqlClient = exports.SolidRdfEngine = exports.rdfReadGraphAllowed = exports.rdfAccessGraphAllowed = exports.rdfAccessCacheScope = exports.metadataResourceForGraph = exports.isRestrictiveRdfAccessScope = exports.isMetadataGraphIri = exports.filterRdfAccessGraphs = exports.applyRdfAccessScope = exports.METADATA_GRAPH_PREFIX = exports.rdfVar = exports.RdfQueryExecutor = exports.diffQuads = exports.canonicalQuadKey = exports.RdfShadowComparator = exports.rdfContentTypeForPath = exports.normalizeContentType = exports.isSafeRdfDocumentContentType = exports.isRdfDocumentPath = exports.isRdfDocumentContentType = exports.isRdfDocument = exports.isLineAddressableRdfPath = exports.isLineAddressableRdfContentType = exports.isLineAddressableRdf = exports.PostgresRdfStatisticsStore = exports.PostgresRdfVectorIndex = exports.RdfVectorIndex = exports.RDF_VECTOR_SCHEMA_VERSION = exports.PostgresRdfTextIndex = exports.rdfTextIndexPolicyRole = exports.parseRdfTextProjectionQuads = exports.createRdfEntityTextChunksFromText = exports.createRdfEntityTextChunks = exports.tokenizeNormalizedRdfText = exports.RdfTextIndex = exports.RDF_TEXT_SCHEMA_VERSION = exports.Rdf3xIndex = exports.RdfQuadIndex = exports.rdfNumericValue = exports.isRdfNumericTerm = exports.isRdfNumericDatatype = exports.isFiniteNumericLexical = exports.RDF_NUMERIC_DATATYPES = exports.RdfTermDictionary = void 0;
|
|
4
|
+
exports.RDF_MODELS_SYNTHETIC_MESSAGE_QUADS = exports.seedRdfModelsSearchFusionIndexes = exports.runRdfModelsShadowBenchmark = exports.runRdfModelsRdf3xShadowBenchmark = exports.runRdfModelsPostgresBenchmark = exports.runRdfModelsBenchmark = exports.rdfModelsSearchFusionBroadSourceCountForScale = exports.rdfModelsBenchmarkScaleTargetQuads = exports.rdfModelsBenchmarkSyntheticPodCount = exports.rdfModelsBenchmarkTargetSatisfied = exports.rdfModelsBenchmarkScaleSatisfied = exports.rdfModelsBenchmarkProfileRequiresSearchFusion = exports.syntheticMessagesForRdfModelsTargetQuads = exports.estimateRdfModelsSyntheticQuadCount = exports.defaultSyntheticMessagesForRdfModelsScale = exports.buildRdfModelsBenchmarkSeed = exports.RDF_MODELS_BENCHMARK_POD = exports.rdfModelsSearchFusionQueryBenchmarkCaseNames = exports.rdfModelsSearchFusionQueryBenchmarkCases = exports.rdfModelsQueryBenchmarkCasesForProfile = exports.rdfModelsQueryBenchmarkCaseNames = exports.rdfModelsQueryBenchmarkCases = exports.rdfModelsPostgresQueryBenchmarkCasesForProfile = exports.rdfModelsPostgresQueryBenchmarkCaseNames = exports.rdfModelsPostgresQueryBenchmarkCases = exports.rdfModelsPostgresMaterializedQueryBenchmarkCaseNames = exports.rdfModelsPostgresMaterializedQueryBenchmarkCases = exports.rdfModelsExtremeQueryBenchmarkCaseNames = exports.rdfModelsExtremeQueryBenchmarkCases = exports.rdfModelsExtremeBenchmarkCaseNames = exports.rdfModelsExtremeBenchmarkCases = exports.rdfModelsBenchmarkCasesForProfile = exports.rdfModelsBenchmarkCaseNames = exports.rdfModelsBenchmarkCases = exports.assertServerOwnedNativeSparqlQuery = exports.sparqlCorrectionForCapability = exports.UnsupportedSparqlQueryError = exports.NativeSparqlTimeoutError = exports.NativeSparqlExecutionError = void 0;
|
|
5
5
|
var RdfTermDictionary_1 = require("./RdfTermDictionary");
|
|
6
6
|
Object.defineProperty(exports, "RdfTermDictionary", { enumerable: true, get: function () { return RdfTermDictionary_1.RdfTermDictionary; } });
|
|
7
7
|
var RdfTermSemantics_1 = require("./RdfTermSemantics");
|
|
@@ -50,11 +50,15 @@ var RdfQueryExecutor_1 = require("./RdfQueryExecutor");
|
|
|
50
50
|
Object.defineProperty(exports, "RdfQueryExecutor", { enumerable: true, get: function () { return RdfQueryExecutor_1.RdfQueryExecutor; } });
|
|
51
51
|
Object.defineProperty(exports, "rdfVar", { enumerable: true, get: function () { return RdfQueryExecutor_1.variable; } });
|
|
52
52
|
var RdfAccessScope_1 = require("./RdfAccessScope");
|
|
53
|
+
Object.defineProperty(exports, "METADATA_GRAPH_PREFIX", { enumerable: true, get: function () { return RdfAccessScope_1.METADATA_GRAPH_PREFIX; } });
|
|
53
54
|
Object.defineProperty(exports, "applyRdfAccessScope", { enumerable: true, get: function () { return RdfAccessScope_1.applyRdfAccessScope; } });
|
|
54
55
|
Object.defineProperty(exports, "filterRdfAccessGraphs", { enumerable: true, get: function () { return RdfAccessScope_1.filterRdfAccessGraphs; } });
|
|
56
|
+
Object.defineProperty(exports, "isMetadataGraphIri", { enumerable: true, get: function () { return RdfAccessScope_1.isMetadataGraphIri; } });
|
|
55
57
|
Object.defineProperty(exports, "isRestrictiveRdfAccessScope", { enumerable: true, get: function () { return RdfAccessScope_1.isRestrictiveRdfAccessScope; } });
|
|
58
|
+
Object.defineProperty(exports, "metadataResourceForGraph", { enumerable: true, get: function () { return RdfAccessScope_1.metadataResourceForGraph; } });
|
|
56
59
|
Object.defineProperty(exports, "rdfAccessCacheScope", { enumerable: true, get: function () { return RdfAccessScope_1.rdfAccessCacheScope; } });
|
|
57
60
|
Object.defineProperty(exports, "rdfAccessGraphAllowed", { enumerable: true, get: function () { return RdfAccessScope_1.rdfAccessGraphAllowed; } });
|
|
61
|
+
Object.defineProperty(exports, "rdfReadGraphAllowed", { enumerable: true, get: function () { return RdfAccessScope_1.rdfReadGraphAllowed; } });
|
|
58
62
|
var SolidRdfEngine_1 = require("./SolidRdfEngine");
|
|
59
63
|
Object.defineProperty(exports, "SolidRdfEngine", { enumerable: true, get: function () { return SolidRdfEngine_1.SolidRdfEngine; } });
|
|
60
64
|
var LocalQleverNativeSparqlClient_1 = require("./LocalQleverNativeSparqlClient");
|
|
@@ -25,6 +25,9 @@ export interface SparqlEngine {
|
|
|
25
25
|
queryVoid(query: string, basePath: string, accessScope?: RdfAccessScope, options?: SparqlVoidOptions): Promise<void>;
|
|
26
26
|
constructGraph(graph: string, basePath: string, accessScope?: RdfAccessScope): Promise<AsyncIterator<Quad>>;
|
|
27
27
|
listGraphs(basePath: string, accessScope?: RdfAccessScope): Promise<Set<string>>;
|
|
28
|
+
/** Optional: explicit metadata facet read. Absent means the engine cannot serve it. */
|
|
29
|
+
queryMetadataBindings?(query: string, basePath: string, accessScope?: RdfAccessScope, options?: SparqlQueryOptions): Promise<any>;
|
|
30
|
+
listMetadataGraphs?(basePath: string, accessScope?: RdfAccessScope): Promise<Set<string>>;
|
|
28
31
|
close(): Promise<void>;
|
|
29
32
|
}
|
|
30
33
|
/**
|
|
@@ -46,5 +49,7 @@ export declare class SubgraphQueryEngine {
|
|
|
46
49
|
queryVoid(query: string, basePath: string, accessScope?: RdfAccessScope, options?: SparqlVoidOptions): Promise<void>;
|
|
47
50
|
constructGraph(graph: string, basePath: string, accessScope?: RdfAccessScope): Promise<AsyncIterator<Quad>>;
|
|
48
51
|
listGraphs(basePath: string, accessScope?: RdfAccessScope): Promise<Set<string>>;
|
|
52
|
+
queryMetadataBindings(query: string, basePath: string, accessScope?: RdfAccessScope, options?: SparqlQueryOptions): Promise<any>;
|
|
53
|
+
listMetadataGraphs(basePath: string, accessScope?: RdfAccessScope): Promise<Set<string>>;
|
|
49
54
|
close(): Promise<void>;
|
|
50
55
|
}
|
|
@@ -34,6 +34,15 @@ class SubgraphQueryEngine {
|
|
|
34
34
|
async listGraphs(basePath, accessScope) {
|
|
35
35
|
return this.impl.listGraphs(basePath, accessScope);
|
|
36
36
|
}
|
|
37
|
+
async queryMetadataBindings(query, basePath, accessScope, options) {
|
|
38
|
+
if (!this.impl.queryMetadataBindings) {
|
|
39
|
+
throw new Error('This SPARQL engine does not expose metadata facet reads.');
|
|
40
|
+
}
|
|
41
|
+
return this.impl.queryMetadataBindings(query, basePath, accessScope, options);
|
|
42
|
+
}
|
|
43
|
+
async listMetadataGraphs(basePath, accessScope) {
|
|
44
|
+
return this.impl.listMetadataGraphs ? this.impl.listMetadataGraphs(basePath, accessScope) : new Set();
|
|
45
|
+
}
|
|
37
46
|
async close() {
|
|
38
47
|
return this.impl.close();
|
|
39
48
|
}
|
|
@@ -35,6 +35,14 @@
|
|
|
35
35
|
"@id": "undefineds:dist/storage/sparql/SubgraphQueryEngine.jsonld#SparqlEngine__member_listGraphs",
|
|
36
36
|
"memberFieldName": "listGraphs"
|
|
37
37
|
},
|
|
38
|
+
{
|
|
39
|
+
"@id": "undefineds:dist/storage/sparql/SubgraphQueryEngine.jsonld#SparqlEngine__member_queryMetadataBindings",
|
|
40
|
+
"memberFieldName": "queryMetadataBindings"
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
"@id": "undefineds:dist/storage/sparql/SubgraphQueryEngine.jsonld#SparqlEngine__member_listMetadataGraphs",
|
|
44
|
+
"memberFieldName": "listMetadataGraphs"
|
|
45
|
+
},
|
|
38
46
|
{
|
|
39
47
|
"@id": "undefineds:dist/storage/sparql/SubgraphQueryEngine.jsonld#SparqlEngine__member_close",
|
|
40
48
|
"memberFieldName": "close"
|
|
@@ -91,6 +99,14 @@
|
|
|
91
99
|
"@id": "undefineds:dist/storage/sparql/SubgraphQueryEngine.jsonld#SubgraphQueryEngine__member_listGraphs",
|
|
92
100
|
"memberFieldName": "listGraphs"
|
|
93
101
|
},
|
|
102
|
+
{
|
|
103
|
+
"@id": "undefineds:dist/storage/sparql/SubgraphQueryEngine.jsonld#SubgraphQueryEngine__member_queryMetadataBindings",
|
|
104
|
+
"memberFieldName": "queryMetadataBindings"
|
|
105
|
+
},
|
|
106
|
+
{
|
|
107
|
+
"@id": "undefineds:dist/storage/sparql/SubgraphQueryEngine.jsonld#SubgraphQueryEngine__member_listMetadataGraphs",
|
|
108
|
+
"memberFieldName": "listMetadataGraphs"
|
|
109
|
+
},
|
|
94
110
|
{
|
|
95
111
|
"@id": "undefineds:dist/storage/sparql/SubgraphQueryEngine.jsonld#SubgraphQueryEngine__member_close",
|
|
96
112
|
"memberFieldName": "close"
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { AiBuiltinProviderSummary } from './contract/ai-connections-client.js';
|
|
2
|
+
/**
|
|
3
|
+
* The deployment's own read-only AI Connections.
|
|
4
|
+
*
|
|
5
|
+
* These are not Pod providers: the server declares them about itself
|
|
6
|
+
* (`builtin: true` + `readOnly: true`), the user owns no credential for them,
|
|
7
|
+
* and there is nothing here to enable, disable, edit or delete. Rendering them
|
|
8
|
+
* on their own section is what keeps a personal-catalog failure from erasing a
|
|
9
|
+
* directory the caller never had to read the Pod for.
|
|
10
|
+
*/
|
|
11
|
+
/**
|
|
12
|
+
* The four states of the declared directory, kept apart on purpose.
|
|
13
|
+
*
|
|
14
|
+
* A failed read and a successful empty read look identical on screen if both are
|
|
15
|
+
* projected to `[]`, and then the page tells the user "there are none" when it
|
|
16
|
+
* simply does not know. That is the same false certainty as the original
|
|
17
|
+
* zero-model pane, so they stay distinct here.
|
|
18
|
+
*/
|
|
19
|
+
export type BuiltinDirectoryState = {
|
|
20
|
+
status: 'unsupported';
|
|
21
|
+
} | {
|
|
22
|
+
status: 'loading';
|
|
23
|
+
} | {
|
|
24
|
+
status: 'failed';
|
|
25
|
+
message: string;
|
|
26
|
+
} | {
|
|
27
|
+
status: 'ready';
|
|
28
|
+
providers: AiBuiltinProviderSummary[];
|
|
29
|
+
};
|
|
30
|
+
export declare function AiBuiltinProvidersSection({ state }: {
|
|
31
|
+
state: BuiltinDirectoryState;
|
|
32
|
+
}): import("react").JSX.Element;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Badge, EmptyState, InlineNotice } from '@undefineds.co/shared-ui';
|
|
3
|
+
import { Server } from 'lucide-react';
|
|
4
|
+
export function AiBuiltinProvidersSection({ state }) {
|
|
5
|
+
const catalog = state.status === 'ready' ? state.providers : [];
|
|
6
|
+
const modelCount = catalog.reduce((total, provider) => total + provider.models.length, 0);
|
|
7
|
+
return (_jsxs("section", { className: "space-y-8", "aria-label": "\u90E8\u7F72\u5185\u7F6E\u6A21\u578B", children: [_jsx("div", { "data-testid": "builtin-providers-header", className: "flex flex-wrap items-center justify-between gap-2", children: _jsxs("div", { className: "flex min-w-0 flex-wrap items-center gap-x-2 gap-y-1", children: [_jsxs("h3", { className: "flex items-center gap-2 text-sm font-medium leading-normal text-foreground/90", children: [_jsx(Server, { "aria-hidden": "true", className: "h-4 w-4 text-primary" }), "\u90E8\u7F72\u5185\u7F6E\u6A21\u578B"] }), state.status === 'ready' ? (_jsx("span", { className: "text-xs leading-normal text-muted-foreground", children: `共 ${catalog.length} 个提供商 · ${modelCount} 个模型` })) : null, _jsx("span", { className: "text-xs leading-normal text-muted-foreground", children: "\u7531\u5F53\u524D\u90E8\u7F72\u63D0\u4F9B\uFF0C\u53EA\u8BFB" })] }) }), state.status === 'unsupported' ? (_jsx(EmptyState, { description: "\u8FD9\u4E2A\u5BA2\u6237\u7AEF\u65E0\u6CD5\u8BFB\u53D6\u90E8\u7F72\u5185\u7F6E\u6A21\u578B\u76EE\u5F55" })) : state.status === 'loading' ? (_jsx(EmptyState, { description: "\u90E8\u7F72\u5185\u7F6E\u6A21\u578B\u76EE\u5F55\u5C1A\u672A\u5C31\u7EEA" })) : state.status === 'failed' ? (_jsx(InlineNotice, { tone: "destructive", role: "alert", children: `部署内置模型目录读取失败:${state.message}` })) : catalog.length === 0 ? (_jsx(EmptyState, { description: "\u5F53\u524D\u90E8\u7F72\u6CA1\u6709\u5185\u7F6E\u6A21\u578B" })) : (_jsx("div", { className: "space-y-4", children: catalog.map((provider) => (_jsxs("div", { className: "space-y-2", children: [_jsxs("div", { className: "flex flex-wrap items-center gap-2", children: [_jsx("span", { className: "text-sm font-medium text-foreground/90", children: provider.name }), _jsx("code", { className: "font-mono text-[10px] text-muted-foreground opacity-70", children: provider.id }), _jsx(Badge, { variant: "outline", className: "shrink-0 text-[10px] font-normal", children: "\u53EA\u8BFB" })] }), provider.models.length === 0 ? (_jsx("p", { className: "text-xs text-muted-foreground", children: "\u8BE5\u63D0\u4F9B\u5546\u672A\u58F0\u660E\u6A21\u578B" })) : (_jsx("ul", { "aria-label": `${provider.name} 的模型`, className: "grid gap-2", children: provider.models.map((model) => (_jsx("li", { className: "flex items-center gap-3 rounded-lg border border-border/40 bg-card p-3", children: _jsxs("div", { className: "min-w-0 flex-1", children: [_jsx("span", { className: "truncate text-sm font-medium text-foreground/90", children: model.displayName ?? model.id }), _jsx("div", { className: "mt-0.5 flex items-center gap-1.5", children: _jsx("code", { className: "max-w-[300px] truncate font-mono text-[10px] text-muted-foreground opacity-70", children: model.id }) })] }) }, `${provider.id}\0${model.id}`))) }))] }, provider.id))) }))] }));
|
|
8
|
+
}
|
|
@@ -107,6 +107,40 @@ export function AiConnectionsPanel({ client, onAuthorizeService, renderToaster =
|
|
|
107
107
|
.catch(() => undefined);
|
|
108
108
|
return () => { active = false; };
|
|
109
109
|
}, [client, gatewayCatalogVersion]);
|
|
110
|
+
/**
|
|
111
|
+
* The deployment's declared read-only directory, on its own request.
|
|
112
|
+
*
|
|
113
|
+
* It must not share a promise with `listProviders`/`listModels`: a Pod read
|
|
114
|
+
* that fails (or a personal catalogue that is simply empty) says nothing about
|
|
115
|
+
* what the deployment itself offers, and coupling them is exactly how a real
|
|
116
|
+
* built-in row disappeared from the page. The four outcomes stay distinct —
|
|
117
|
+
* unsupported / loading / failed / ready — because a failed read must never be
|
|
118
|
+
* rendered as "there are none", and a personal failure must stay its own
|
|
119
|
+
* message.
|
|
120
|
+
*/
|
|
121
|
+
const [builtinDirectory, setBuiltinDirectory] = useState(() => (typeof client.listBuiltinProviders === 'function' ? { status: 'loading' } : { status: 'unsupported' }));
|
|
122
|
+
useEffect(() => {
|
|
123
|
+
const read = client.listBuiltinProviders;
|
|
124
|
+
if (!read) {
|
|
125
|
+
setBuiltinDirectory({ status: 'unsupported' });
|
|
126
|
+
return;
|
|
127
|
+
}
|
|
128
|
+
let active = true;
|
|
129
|
+
setBuiltinDirectory({ status: 'loading' });
|
|
130
|
+
void read.call(client)
|
|
131
|
+
.then((providers) => {
|
|
132
|
+
if (active)
|
|
133
|
+
setBuiltinDirectory({ status: 'ready', providers });
|
|
134
|
+
})
|
|
135
|
+
.catch((cause) => {
|
|
136
|
+
if (active)
|
|
137
|
+
setBuiltinDirectory({ status: 'failed', message: aiConnectionsErrorMessage(cause) });
|
|
138
|
+
});
|
|
139
|
+
// A response for a replaced client (or an unmounted page) is never adopted.
|
|
140
|
+
return () => { active = false; };
|
|
141
|
+
// The directory is deployment-wide and static, so it follows the client
|
|
142
|
+
// only: a Pod write must not cost a second read of a fact it cannot change.
|
|
143
|
+
}, [client]);
|
|
110
144
|
// A result is only current for the client + catalog revision it was loaded for;
|
|
111
145
|
// a stale response (or a not-yet-reloaded catalog) reads as undefined.
|
|
112
146
|
const gatewayModels = gatewayCatalog?.client === client
|
|
@@ -732,7 +766,7 @@ export function AiConnectionsPanel({ client, onAuthorizeService, renderToaster =
|
|
|
732
766
|
values: { ...current.values, [definition.id]: value },
|
|
733
767
|
})), onBeginApiKey: () => void beginApiKey(definition.id), onBeginOffering: (offering, mode, method) => void beginOfferingConnect(definition.id, offering, mode, method), onCancelConnect: (attempt) => void cancelConnect(definition.id, attempt), onBeginBrowser: () => void beginBrowserConnect(definition), onSaveApiKey: () => void saveApiKey(definition), onDisconnect: (credential) => void disconnect(definition.id, credential?.id), onCreateApiKeyCredential: (offering, input) => createApiKeyCredential(definition.id, offering, input), onCreateLocalCredential: (offering, method) => createLocalCredential(definition.id, offering, method), onUpdateCredential: (credential, patch) => updateProviderCredential(definition.id, credential, patch), onDeleteCredential: (credential) => void deleteProviderCredential(definition.id, credential), onTestCredential: (credential) => void testProviderCredential(definition.id, credential), onReorderCredentials: (offering, credentials, fromIndex, toIndex) => void reorderProviderCredentials(definition.id, offering, credentials, fromIndex, toIndex), onRefreshQuota: (offering, credential) => void refreshQuota(definition.id, offering, credential), verifyPending: Boolean(verifyingProviders[definition.id]), onVerify: () => void verifyProvider(definition.id), onAddModel: () => openModelEditor(definition.id), onEditModel: (model) => openModelEditor(definition.id, model), onDeleteModel: (model) => void deleteProviderModel(definition.id, model), onModelSelectionChange: handleModelSelectionChange, onDismissError: () => setProviderError(definition.id) }, definition.id));
|
|
734
768
|
})] }));
|
|
735
|
-
const keyContent = (_jsx(AiGatewayKeysSection, { client: client, onAuthorizeService: onAuthorizeService, clientConfigurationBridge: clientConfigurationBridge, gatewayModels: gatewayModels, modelSelection: gatewayModelSelection, liveRevision: liveRevision }));
|
|
769
|
+
const keyContent = (_jsx(AiGatewayKeysSection, { client: client, onAuthorizeService: onAuthorizeService, clientConfigurationBridge: clientConfigurationBridge, gatewayModels: gatewayModels, modelSelection: gatewayModelSelection, liveRevision: liveRevision, builtinDirectory: builtinDirectory }));
|
|
736
770
|
return (_jsxs("div", { "data-testid": "ai-connections-panel", className: "mx-auto w-full max-w-5xl space-y-10 px-4 py-6 sm:px-8 sm:py-8", children: [renderToaster ? _jsx(Toaster, {}) : null, selectedSection === 'keys' ? keyContent : null, selectedSection === 'provider' ? providerContent : null, selectedSection === 'provider' && modelEditor ? (_jsx(AiModelEditorDialog, { open: true, providerName: PROVIDERS.find((definition) => definition.id === modelEditor.provider)?.name ?? modelEditor.provider, initialValue: modelEditor.model
|
|
737
771
|
? {
|
|
738
772
|
id: modelEditor.model.id,
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { AiConnectionsClient, AiGatewayModel } from './contract/ai-connections-client.js';
|
|
2
2
|
import { type AiClientConfigurationBridge } from './AiClientConfigurationSection.js';
|
|
3
3
|
import { type GatewayModelSelection } from './AiGatewayModelsSection.js';
|
|
4
|
+
import { type BuiltinDirectoryState } from './AiBuiltinProvidersSection.js';
|
|
4
5
|
/**
|
|
5
6
|
* The Xpod provider page. From a coding client's point of view Xpod is just
|
|
6
7
|
* another provider, so this surface shares the provider pages' components: the
|
|
@@ -8,7 +9,7 @@ import { type GatewayModelSelection } from './AiGatewayModelsSection.js';
|
|
|
8
9
|
* over `AiModelCatalog`), and the same endpoint list (`AiEndpointList`) that the
|
|
9
10
|
* provider pages use for their offerings' protocols.
|
|
10
11
|
*/
|
|
11
|
-
export declare function AiGatewayKeysSection({ client, onAuthorizeService, clientConfigurationBridge, gatewayModels, modelSelection, liveRevision, }: {
|
|
12
|
+
export declare function AiGatewayKeysSection({ client, onAuthorizeService, clientConfigurationBridge, gatewayModels, modelSelection, liveRevision, builtinDirectory, }: {
|
|
12
13
|
client: AiConnectionsClient;
|
|
13
14
|
onAuthorizeService?: () => Promise<void>;
|
|
14
15
|
clientConfigurationBridge?: AiClientConfigurationBridge;
|
|
@@ -20,4 +21,11 @@ export declare function AiGatewayKeysSection({ client, onAuthorizeService, clien
|
|
|
20
21
|
* client, a script); the Key list lives in that table and re-reads with it.
|
|
21
22
|
*/
|
|
22
23
|
liveRevision?: number;
|
|
24
|
+
/**
|
|
25
|
+
* The deployment's declared read-only directory, read by the caller on its own
|
|
26
|
+
* request. It is rendered next to the key surface precisely because it does
|
|
27
|
+
* not depend on the personal catalogue that the keys need.
|
|
28
|
+
*/
|
|
29
|
+
/** The declared directory's explicit read state, owned by the caller. */
|
|
30
|
+
builtinDirectory?: BuiltinDirectoryState;
|
|
23
31
|
}): import("react").JSX.Element;
|